Comparison operators compare two values and return a boolean result — either True or False. Python provides six comparison operators: equal to (==), not equal to (!=), greater than (>), less than (<), greater than or equal to (>=), and less than or equal to (<=). They are essential for making decisions in your code with if statements and loops.
Key Points
== checks if two values are equal: 5 == 5 → True.
!= checks if two values are not equal: 5 != 3 → True.
> checks if left is greater: 10 > 3 → True.
< checks if left is smaller: 3 < 10 → True.
>= checks greater than or equal: 5 >= 5 → True.
<= checks less than or equal: 3 <= 10 → True.
All comparison operators return a bool (True or False).