# .css-fhxb3m{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.css-9a49z0{margin-right:0.5rem;height:2.5rem;width:2.5rem;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;overflow:hidden;border-radius:9999px;}  Prahlad Inala

Follow

Follow # Comparison Operators in Python

·Jul 11, 2021·

## What are Comparison Operators in Python?

Comparison operators are used to comparing different values in python. Comparison operators evaluate to a boolean value,i.e,True (or) False.

Following are the comparison operators in python:

1. ==
2. !=
3. >
4. <
5. >=
6. <=

## == Operator

``````x = 5
y = 3
print(x == y)
#False
# returns False because 5 is not equal to 3
``````

## != Operator

``````x = 5
y = 3
print(x != y)
#True
# returns True because 5 is not equal to 3
``````

## > Operator

``````x = 5
y = 3
print(x > y)
#True
# returns True because 5 is greater than 3
``````

## < Operator

``````x = 5
y = 3
print(x < y)
#False
# returns False because 5 is not less than 3
``````

## >= Operator

``````x = 5
y = 3
print(x >= y)
#True
# returns True because five is greater, or equal, to 3
``````

## <= Operator

``````x = 5
y = 3
print(x <= y)
#False
# returns False because 5 is neither less than or equal to 3
``````