Python Tricks #16 - All or Any

Words
0
Reading
0 min
7y
Listen to this post
~1 min
x = [True, True, False]

if any(x):
    print("At least one True")

if all(x):
    print("Not one False")

if any(x) and not all(x):
    print("At least one True and one False")
Python Tricks #16 - All or Any | Ecency