Relational or Comparison Operators in python


Relational or Comparison Operators


Relational operators evaluate values on the left and right side of the operator and return the relation as either True or False.


Here are the relational operators in Python:

Operator
Meaning


==
is equal to


< 
is less than


> 
is greater than


<=
is less than or equal to


>=
is greater than or equal to


!=
is not equal to







Examples:



>>> 8 == 6+2

True



>>> 6 != 6 False


>>> -1 > 0 False


>>> 7 >= 5

True



Comments