Back
+10 XP
Concept

Inverting Reality (not)

The `not` operator flips boolean truth completely upside down:

python
game_over = False
if not game_over:
    print("Keep playing!")

# 49. Inverting Reality (not) The `not` operator flips boolean truth completely upside down: ```python game_over = False if not game_over: print("Keep playing!") ``` `not True` becomes `False`; `not False` becomes `True`. It works on numbers too: `not 0` becomes `True` because 0 is falsy.

Checkpoint

What does `not 0` evaluate to?

Practice

Create `banned = False`. Write an `if` using `not banned` that prints `"Access granted"`.

Terminal
01
Tap code blocks below to assemble
Available Blocks