Table of Contents

Comparison operators

  • The relational operator is used to compare two operands to see whether they are equal to each other, unequal, or one is greater or lesser than the other.
  • Comparison Operator is also called Relational Operators
Name Purpose
== equality
!= Not equal to
< less than
> greater than
< = less than or equal to
> = greater than or equal to

Example

Use of Comparison operators

x = 8
y = 3
print(x==y)
print(x!=y)
print(x<y)
print(x>y)
print(x<=y)
print(x>=y)

Output

11
English Hindi