When we change a value to its opposite with not
, we negate it, like here with not True
.
print(not True)
The not
operator before False
changes its value. If a value is not False
, it has to be True
. We can see it here by displaying not False
.
print(not False)
We can use the not
operator with variables to negate their values. By displaying not available
here, we'll see its negated value.
available = True
print(not available)
We can save a whole negation in another variable, too. Like here is_evening
should store the value of not morning
.
morning = True
is_evening = not morning
print(is_evening)