+ 1

# True and False. I'm confused.

a=6 b=7 print(8, not (a==7 and b==6)) print(9, not a==7 and b==6) Why 8, is True? Why 9 ,is False? Both looks the same.

3 Answers

+ 4

It's like math lessons. First parentheses then from left to right.
So in the first print statement we have:
not (a==7 and b==6)
not (false and false)
not (false)
true
And in the second print statement we have:
not a==7 and b==6
not false and false
true and false
false

+ 2

Thank you so much. No more headaches.