3. The not
Operator. In Python, the not
operator is used to negate a condition. It returns True
if the condition is False
, and False
if the condition is True
.
For example, the expression not (x > 5)
evaluates to True
if x
is not greater than 5.
In the exercise below, set condition = True
and then use the note
operator to negate it.