all in python
'''
Return Value from all()
all() method returns:
True - If all elements in an iterable are true
False - If any element in an iterable is false
'''
# all values true
l = [1, 3, 4, 5]
print(all(l)) # Result : True
# all values false
l = [0, False]
print(all(l)) # Result : False
# one false value ( As 0 is considered as False)
l = [1, 3, 4, 0]
print(all(l)) # Result : False
# one true value
l = [0, False, 5]
print(all(l)) # Result : False
# empty iterable
l = []
print(all(l))
# Since all are false, false is returned
print (any([False, False, False, False]))
# Here the method will short-circuit at the
# second item (True) and will return True.
print (any([False, True, False, False]))
# Here the method will short-circuit at the
# first (True) and will return True.
print (any([True, False, False, False]))
# Here all the iterables are True so all
# will return True and the same will be printed
print (all([True, True, True, True]))
# Here the method will short-circuit at the
# first item (False) and will return False.
print (all([False, True, True, False]))
# This statement will return False, as no
# True is found in the iterables
print (all([False, False, False]))