为了便于看清,我用<=>来表示等价关系。
<=>左边表示逻辑表达式,<=>右边表示它的结果。
NOT
not False <=> True
not True <=> False
(not的结果与原值相反)
OR
True or False <=> True
True or True <=> True
False or True <=> True
False or False <=> False
(只要有一个值为True,OR的结果就是True)
AND
True and False <=> False
True and True <=> True
False and True <=> False
False and False <=> False
(只要有一个值为False,AND的结果就是False)
NOT OR
not (True or False) <=> False
not (True or True) <=> False
not (False or True) <=> False
not (False or False) <=> True
NOT AND
not (True and False) <=> True
not (True and True) <=> False
not (False and True) <=> True
not (False and False) <=> True
!=
1 != 0 <=> True
1 != 1 <=> False
0 != 1 <=> True
0 != 0 <=> False
==
1 == 0 <=> False
1 == 1 <=> True
0 == 1 <=> False
0 == 0 <=> True