Python 2: QUESTION "Not Not False" Not Lesson - Conditionals & Control Flow


I am currently learning about the And, Or, Not - True or False Boolean Operators in this Python course.
In one of my recent exercises, I had to fill the result of a boolean that said “Not Not False”. At first, I entered the answer as True, thinking that the answer was opposite of False. However, much to my surprise, the answer to this boolean is False. Why?

Why can’t the answer to “Not Not False” boolean be “True”?

I appreciate all your help and advice in advance.

not False is true, but then you end up with not True (given you had not twice), which again flips the Boolean

not makes True → False and vice versa. so: not not not False would be true

1 Like

I’m not sure if this way will help you to understand better:

result1 = False
result2 = not result1
result3 = not result2

print(result1,result2, result3)

Otherwise, look at it this way:

print(False, not False, not(not False))

so would print(False, not False, not(not False)) be true or false?

So Not not False would still be False?

yes, the first not flips the boolean from false to true, then the second not will flip it again/back.

I use not not sometimes to convert a truthy/falsy value to a boolean, for example:

print(not not "I am true") # prints: true

If “Not Not False” be “True”, then what will be your result for “Not False”?

so would print(False, not False, not(not False)) be true or false?
You can run that statement in Python to see the result.

print(False, not False, not(not False))
False True False

I was trying to illustrate to you the gradual change from False, not False and then not not False. Hence, to answer your question, Not Not False = False.

While in JavaScript !!x is terse and I’d agree with the usage there, in Python I think bool(X) is better over not not x. It is terse and arguably more explicit.

1 Like

Thank you very much :slightly_smiling_face:

Yes it is confusing sometimes, but this comment also helped too. Thank you very much :slightly_smiling_face: