小尹学python

导航

Python:运算优先级

# 算数运算符优先级(+-*/等)> 比较运算符(>,<,=)优先级 > 逻辑运算符(not,and,or)
# 逻辑运算符中,not > and > or
# 不确定,可以加()
if not 1 and 1 + 3 > 2 or 3 == 8:
    print(True)
else:
    print(False)

posted on 2021-09-28 17:34  小尹学python  阅读(199)  评论(0)    收藏  举报