06、运算符优先级
运算符优先级
算数运算符 优先级 大于 比较运算符
if 2 + 10 > 11: print('真') else: print('假')
比较运算符 优先级 大于 逻辑运算符
if 1 > 2 and 2 < 10: print('成立') else: print('不成立')
逻辑运算符 内部三个优先级 not > and > or
if not 1 and 1 > 2 or 3 == 8: print('真') else: print('假')
上述三个优先级从高到低:加减乘除 > 比较 > not and or

浙公网安备 33010602011771号