formations/algo/algofundoc/src/testflag.py

18 lines
282 B
Python
Raw Normal View History

2018-08-24 14:09:11 +02:00
# Different ways to test multiple
# flags at once in Python
x, y, z = 0, 1, 0
if x == 1 or y == 1 or z == 1:
print('passed')
if 1 in (x, y, z):
print('passed')
# These only test for truthiness:
if x or y or z:
print('passed')
if any((x, y, z)):
print('passed')