定义变量:
x, y, z = 0, 1, 0
方法一:
if 1 in (x, y, z):
print('passed')
方法二:
if x or y or z:
print('passed')
方法三:
if any((x, y, z)):
print('passed')
方法四:
if x == 1 or y == 1 or z == 1:
print('passed')
x, y, z = 0, 1, 0
if 1 in (x, y, z):
print('passed')
if x or y or z:
print('passed')
if any((x, y, z)):
print('passed')
if x == 1 or y == 1 or z == 1:
print('passed')
评论区