🔀 Comparison Operators.

Last Updated: 15th August 2025


Comparison operators are used to compare two values and they always return a Boolean (True or False).

Hinglish Tip 🗣: Comparison operators se aap check karte ho — kya do values same hain, badi hain, chhoti hain, etc. Result hamesha True ya False hota hai.


OperatorMeaningExampleResult
==Equal to5 == 5True
!=Not equal to5 != 3True
>Greater than10 > 7True
<Less than3 < 8True
>=Greater than or equal to5 >= 5True
<=Less than or equal to4 <= 6True

✏ Syntax & Examples

a = 10
b = 20

print(a == b)   # False
print(a != b)   # True
print(a > b)    # False
print(a < b)    # True
print(a >= 10)  # True
print(b <= 20)  # True

💡 Quick Practice

  • Check if 15 is greater than 10.
  • Test if 7 == 7.
  • Compare if 100 <= 100.
  • Print the result of "cat" < "dog".
  • Try 2+3j == 2+3j and see the result.
  • Exercises