Comparison Operators are used to compare two values. The operation returns a Boolean result which is either True
or False
. First among the comparison operators is the equality/in-equality operator.
The equality operator
This operator is used to compare any two values in Python. If they are the same a boolean True
is returned else False
is returned.
The Inequality operator
As the name suggests, the inequality operator is basically the inverse of the equality operator. It is used to ensure that two values do not match. It will return a boolean True
if the two values don't match and a boolean false
if they do.