Using if not Boolean will do a negation of a boolean is the opposite of its current value. A boolean is a primitive data type and its value can be True or False only.
Simple If value is False, not value would be True, and the statement(s) in if-block will execute would be True.
Or If the value is True, not the value would be False, and the statement(s) in if-block will not execute.
Python if not Boolean Example
The statements inside if block execute only if the boolean value is False.
a = False if not a: print('a is false.')
Do comment if you have any doubts and suggestions on this Python boolean code.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.