Python - Relational Operators

python logo pixel art

Python has relational operators to check relationships between values.



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