Miku992
Miku992

Reputation: 31

not (not false) = True?

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

Answers (3)

SetSlapShot
SetSlapShot

Reputation: 1298

Quick Python interpreter check:

>>> not not False == True
False

Upvotes: 3

David
David

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...

  1. not (not False) == True
  2. not (True) == True
  3. False == True
  4. False

Upvotes: 7

kaldoran
kaldoran

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

Related Questions