Python - Relational Operators
Python has relational operators to check relationships between values.
- == - Equal To
- != - Not Equal To
- > - Greater Than
- < - Less Than
- >= - Greater Than or Equal To
- <= - Less Than or Equal To
Examples
x = 8
y = 12
print(x == y) # False
print(x != y) # True
print(x > y) # False
print(x < y) # True
print(x >= y) # False
print(x <= y) # True
x = 7
y = 7
print(x == y) # True
print(x != y) # False
print(x > y) # False
print(x < y) # False
print(x >= y) # True
print(x <= y) # True