The any and all Functions in Python


Use any and all for boolean tests on iterables.

Source Code

# `any` returns True if any element of the iterable is true
print(any([False, True, False]))

# `all` returns True if all elements are true
print(all([True, True, True]))
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments