Reputation: 13
I am in an exercise of Boolean operators and I do not understand why:
not not True or False and not True = True
I understand:
not not True = True
True or False = False
False and not True = False
not not True or False and not True = False
Upvotes: 0
Views: 57
Reputation: 421
Precedence:
NOT > AND > OR
Therefore
not not True or False and not True = True
Just like:
2 + 3 * 3 - 1 = 10 and not 14.
Upvotes: 0
Reputation: 531165
Typically, and
is given higher precedence than or
, so your expression is equivalent to
(not not True) or (False and not True) == True or (False and False)
== True or False
== True
Upvotes: 2