python all any code example

Example 1: any and all in python3

# 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]))

Example 2: python all any example

if true and true and true and true: none
if all ([true, true, true, true]): none

if true or true or true or true or true: none
if any ([true, true, true, true, true]): none