1、and
"与" ,如果 x 为 False,x and y 返回 False,否则它返回 y 的计算值。
10<1 and 3>1 #10<1为False,所以整体为False
---------------------------False
10>1 and 3>1 #10>1为True,所以看3>1的布尔值,3>1为True,则整体值为True.
----------------------------------------------------------------------------------------True
2、or
"或",如果 x 是非 0,它返回 x 的值,否则它返回 y 的计算值。
10>1 or 3>1. #10>1位True,则直接返回10>1的布尔值。
----------------------------------------------------------------True
10<1 or 3>1. #因为10<1位False, 则返回3>1的布尔值。
-----------------------------------------------------------------True
3、not
"非" - 如果 x 为 True,返回 False 。如果 x 为 False,它返回 True。
notTrue--------------------------False
4、逻辑运算符的优先级
从左到右:() > not > and > or
计算&