逻辑运算符运算

1、and、or、not的优先级

优先级从大到小:()>not>and>or

2、输出返回值时,x or y,x为True,则返回x

print(1 or 2) 返回1
print(3 or 2) 返回3

3、输出反回值时,x and y,x为True,则返回Y(and与or 相反

print(1 and 2) 返回2
print(3 and 2) 返回2

posted @ 2018-06-09 22:22  路潇  阅读(274)  评论(0)    收藏  举报