...

/

Comparison Operators

Comparison Operators

Get familiar with comparisons in Python using comparison operators, including basic comparisons, as well as the 'is' and 'is not' operators.

Comparison operators can be used to compare values in mathematical terms. The precedence of comparison operator is same.

Symbol

Operator

>

Greater Than

<

Less Than

>=

Greater Than or Equal To

<=

Less Than or Equal To

==

Equal To

!=

Not Equal To

Output of comparison operators

The result of a comparison is always a bool. If the comparison is correct, the value of the bool will be True. Otherwise, its value will be False.

Try it yourself

...
Access this course and 1400+ top-rated courses and projects.