Situatie
The all() function returns True if all elements in the given iterable are true. If not, it returns False.
Solutie
Pasi de urmat
# all values true
l = [1, 3, 4, 5]
print(all(l))
# all values false
l = [0, False]
print(all(l))
# one false value
l = [1, 3, 4, 0]
print(all(l))
# one true value
l = [0, False, 5]
print(all(l))
# empty iterable
l = []
print(all(l))
Output:
True
False
False
False
True
Leave A Comment?