2.7. Syntax Comparison

2.7.1. Greater Than

  • obj > obj

>>> 1 > 2
False
>>> x = 1
>>> x > 2
False
>>> x = 1
>>> y = 2
>>>
>>> x > y
False

2.7.2. Greater or Equal Then

  • obj >= obj

>>> 1 >= 2
False
>>> x = 1
>>> x >= 2
False
>>> x = 1
>>> y = 2
>>>
>>> x >= y
False

2.7.3. Less Than

  • obj < obj

>>> 1 < 2
True
>>> x = 1
>>> x < 2
True
>>> x = 1
>>> y = 2
>>>
>>> x < y
True

2.7.4. Less or Equal Then

  • obj <= obj

>>> 1 <= 2
True
>>> x = 1
>>> x <= 2
True
>>> x = 1
>>> y = 2
>>>
>>> x <= y
True

2.7.5. Equals

  • obj == obj

>>> 1 == 2
False
>>> x = 1
>>> x == 2
False
>>> x = 1
>>> y = 2
>>>
>>> x == y
False
>>> 0 == -0
True

2.7.6. Not Equals

  • Inversion of ==

  • obj != obj

>>> 1 != 2
True
>>> x = 1
>>> x != 2
True
>>> x = 1
>>> y = 2
>>>
>>> x != y
True

2.7.7. Use Case - 0x01

>>> ADULT = 18
>>> user_age = 42
>>>
>>> user_age > ADULT
True