2.6. Syntax Comparison¶
2.6.1. Greater Than¶
obj > obj
>>> 1 > 2
False
>>> x = 1
>>> x > 2
False
>>> x = 1
>>> y = 2
>>>
>>> x > y
False
2.6.2. Greater or Equal Then¶
obj >= obj
>>> 1 >= 2
False
>>> x = 1
>>> x >= 2
False
>>> x = 1
>>> y = 2
>>>
>>> x >= y
False
2.6.3. Less Than¶
obj < obj
>>> 1 < 2
True
>>> x = 1
>>> x < 2
True
>>> x = 1
>>> y = 2
>>>
>>> x < y
True
2.6.4. Less or Equal Then¶
obj <= obj
>>> 1 <= 2
True
>>> x = 1
>>> x <= 2
True
>>> x = 1
>>> y = 2
>>>
>>> x <= y
True
2.6.5. Equals¶
obj == obj
>>> 1 == 2
False
>>> x = 1
>>> x == 2
False
>>> x = 1
>>> y = 2
>>>
>>> x == y
False
>>> 0 == -0
True
2.6.6. Not Equals¶
Inversion of
==
obj != obj
>>> 1 != 2
True
>>> x = 1
>>> x != 2
True
>>> x = 1
>>> y = 2
>>>
>>> x != y
True
2.6.7. Use Case - 0x01¶
>>> ADULT = 18
>>> user_age = 42
>>>
>>> user_age > ADULT
True