Comparison
Comparison operations are supported by all objects. They all have the same priority (which is higher than that those of the Boolean operations).
Operations
<
: strictly less than<=
: less than or equal to>
: strictly greater than>=
: greater than or equal to==
: equal!=
: not equalis
: object identityis not
: negated object identity
Example
print(2 != 3) # True
print(5 >= 4) # True
print(2 is 2) # True
print(300 is 300) # True
num = 350
print(num is not 350) # False
Reference
- Comparisons at docs.python.org