Files
Learn-Python-Programming-Th…/ch03/any.py
T
adii1823 8b802c5c62 ch03
2021-10-28 17:34:45 +05:30

14 lines
358 B
Python

items = [0, None, 0.0, True, 0, 7] # True and 7 evaluate to True
found = False # this is called "flag"
for item in items:
print('scanning item', item)
if item:
found = True # we update the flag
break
if found: # we inspect the flag
print('At least one item evaluates to True')
else:
print('All items evaluate to False')