Python If Not


Not

The not keyword is a logical operator, and is used to reverse the result of the conditional statement:

Example

Test if a is NOT greater than b:

a = 33
b = 200
if not a > b:
  print("a is NOT greater than b")
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.