Python all()

T he all() function returns True if all elements in the given iterable are true. If not, it returns False.

The all() function takes a single parameter:

  • iterable - any iterable (list, tuple, dictionary, etc.) which contains the element

all() function returns:

  • True - If all elements in an iterable are true
  • False - If any element in an iterable is false
All values are trueTrue
All values are false

False

One value is true (others are false)

False

One value is false (others are true)

False

Empty Iterable

True

 


Thinley Jimmy Dorji

1 Blog posts

Comments