涉及知识点:python逻辑运算符的优先级
优先级顺序为 not>and>or。
示例:
x = True
y = False
z = False
if not x or y:
print(1)
elif not x or not y and z:
print(2)
elif not x or y or not y and x:
print(3)
else:
print(4)
输出结果:3
解析:
(not x) or y:False or False -->False
(not x) or (not y) and z:False or (Ture and False)-->False or False -->False
(not x) or y or [(not y) and x]:False or False or [True and Ture]-->False or False or True-->Ture