Comparison Operators

comparison operators are used to compare two values. They return a Boolean result (True or False).

Equal to (==)

Checks if two values are equal.

5 == 5  # True
5 == 6  # False
        

Not equal to (!=)

Checks if two values are not equal.

5 != 6  # True
5 != 5  # False
        

Greater than (>)

Checks if the value on the left is greater than the value on the right.

7 > 5  # True
5 > 7  # False
        

Less than (<)

Checks if the value on the left is less than the value on the right.

5 < 7  # True
7 < 5  # False
        

Greater than or equal to (>=)

Checks if the value on the left is greater than or equal to the value on the right.

7 >= 5  # True
5 >= 5  # True
4 >= 5  # False
        

Less than or equal to (<=)

Checks if the value on the left is less than or equal to the value on the right.

5 <= 7  # True
5 <= 5  # True
7 <= 5  # False
        
What Are People Saying About Us

Read These Life Changing Stories From People Just Like You!