Review Note

Last Update: 07/10/2024 01:20 PM

Current Deck: Python fundamentals

Published

Currently Published Content


Code
x = [0, 0, 1, 0, 1]

if any(x):
    print("yes")
else:
    print("no")

Output
yes
Explanation
any() flags whether any item in the given iterable is truthy.
Context

Current Tags:

python_fundamentals

Pending Suggestions


No pending suggestions for this note.