Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

all, any

all any

  • all(iterable) - returns True if all the elements of iterable return True
  • any(iterable) - returns True if any of the elements in iterable return True
a = [True, True]
b = [True, False]
c = [False, False]

print(all(a))   # True
print(all(b))   # False
print(all(c))   # False
print()
print(any(a))   # True
print(any(b))   # True
print(any(c))   # False

Output: