In [1]:
def test():
    print('function is called')
    return True

In [2]:
print(True and test())


function is called
True

In [3]:
print(False and test())


False

In [4]:
print(True or test())


True

In [5]:
print(False or test())


function is called
True