python

and or not
优先级
not > and > or

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
s = 's'
w = 'w'

# 优先级
# not > and > or
print(s and w) # w
print(s or w) # s
print(True and s) # s
print(True and w) # w
print(True and False and s) # False
print(False and True and s) # False
print(s and True) # True
print(s and False) # False
print(True or s) # True
print(False or s) # s
print(s or False) # s
print(s or True) # s
print(s and w or False) # w