0
我在布爾運算符的鍛鍊,我不明白爲什麼:布爾運算符鍛鍊
not not True or False and not True = True
我的理解:
not not True = True
True or False = False
False and not True = False
not not True or False and not True = False
我在布爾運算符的鍛鍊,我不明白爲什麼:布爾運算符鍛鍊
not not True or False and not True = True
我的理解:
not not True = True
True or False = False
False and not True = False
not not True or False and not True = False
通常,and
給出優先於or
,所以你的表達等同於
(not not True) or (False and not True) == True or (False and False)
== True or False
== True
優先級:
NOT > AND > OR
因此
not not True or False and not True = True
就像:
2 + 3 * 3 - 1 = 10 and not 14.