PYTHON CORE · LESSON 23

On the contrary.

not · about 10 minutes

Learning with progressRead the summary for free. To save the work, log in to the account.
STEP 1

Change the answer.

not flips True into False and False into True.

print(not False)

✦ This is True.

STEP 2

The opposite test

Python will first know if the check in brackets is correct. not then changes the answer.

rain = False
print(not rain)

✦ No rain - True's answer.

IN-CLASS PRACTICE

Type the code yourself

Reprint the example. Remember that False is written with a capital letter.

busy = False
print(not busy)
Open the editor for class work
HOMEWORK

Solve it yourself

Save False to tired. Infer the opposite value with not.

The answer is hidden. Use similar examples from the lesson notes.

Opening up your homework