python and operator returns code example
Example: python and operator returns
'''
Now the interesting part.
The and and or operators actually return values!
With the and operator, each argument is evaluated, and if they all evaluate to True,
the last argument is returned. Otherwise the first False argument is returned.
'''
a = 1
b = 5
print a and b # 5
print b and a # 1
print a and False # False
print a and True # True
print a and None # None
print False and a # False
print None and a # None
print True and 'a' and 0 and True # first False item is zero, 0