NOT Operator

The full text of this chapter, to read or revisit. To practise, do the exercises.

▶ Do the exercises

Exercise 1 — NOT Operator

The not operator is a logical operator that negates the value of a boolean. It returns True if the value is False, and False if the value is True.

Let's display the truth table with code !

print("not False =", not False) print("not True =", not True)

Exercise 2 — Did you get NOT?

Match each formula of the left with its result on the right.

Items to match
• not True
• not False
• not not True
• not not False
Definitions
• False
• True
• True
• False

Exercise 3 — NOT Operator Quiz

What will be the result of not True?

Options
• False
• True
• Error
• None

Hint : NOT operator inverts the boolean value. Since True becomes False, the result is False.

Exercise 4 — Match NOT Results

Match each NOT operation with its correct result:

Items to match
• not True
• not False
• not (True and False)
• not (False or True)
Definitions
• False
• True
• True
• False
Back to the course