TOPIC 2: Variables, Data Types & Operators
Completion requirements
7. Comparison Operators
Comparison operators are used to compare two values and return a boolean value (True or False).
- ==: Equal to
- !=: Not equal to
- >: Greater than
- <: Less than
- >=: Greater than or equal to
- <=: Less than or equal to
Example 1:
x = 5
y = 10
print(x == y) # False
print(x != y) # True
print(x > y) # False
Example 2:
a = 20
b = 15
print(a >= b) # True
print(a <= b) # False