Reputation: 31
I'm currently on page Conditionals & Control Flow, Python, Code Academy.
I've made this thinking it will be False but it is wrong.
Make me false!
bool_three = not (not False) == True
Objects in parentheses are worked out first, so by my logic:
not (not False [which becomes True]) = True
not True [which is false] = True
Upvotes: 0
Views: 15447
Reputation: 1298
Quick Python interpreter check:
>>> not not False == True
False
Upvotes: 3
Reputation: 218827
not (not False [which becomes True]) = True
What makes you think "not not false" would be true? If a boolean value is negated, it becomes the opposite value. If it's negated again, it becomes the original value.
Let's derive it a step at a time...
Upvotes: 7
Reputation: 855
bool_three = not (not False) == True
Here that's goes :
not ( not False ) become not ( true ) became false.
Then False == True (which is false)
so then bool_three = false
Upvotes: 5