search

What is the use of the "not" keyword in Python?

The **not** keyword in Python is used to invert the truthiness of a value. If a value is considered **True** in a boolean context, using **not** will make it **False**, and vice versa. 

For example:

>>> x = True
>>> print(not x)
False
>>> x = False
>>> print(not x)
True

Related Questions You Might Be Interested