Introducing and
|
|
print 'a' and 'b'
print '' and 'b'
print 'a' and 'b' and 'c'
# 0, '', [], (), {}, and None are false in a boolean context; # everything else is true.
#instances of classes are true in a boolean context,
#If all values are true in a boolean context, #and returns the last value.
#In this case, and evaluates 'a', which is true, then 'b', which is true, #and returns 'b'.
#If any value is false in a boolean context, and returns the first false value. #In this case, '' is the first false value.
#All values are true, so and returns the last value, 'c'.
|
|
|
|
|
Related Scripts with Example Source Code in same category :
-
-
-
-
|
|