Computer >> Computer tutorials >  >> Programming >> Python

What is Python equivalent of the ! operator?


In C/C++, ! symbol is defined as not operator. Its equivalent in Python is not operator. It returns true if operand is false and vice versa

>>> not(True)
False
>>> not(False)
True
>>> not(20>30)
True
>>> not('abc'=='ABC')
True