Monday, 20 February 2023

Relational Operators

Relational Operators 

Relational operators are used to compare the values and determines the relation between the operands.

The Relational operators that we can perform in python are:
  1. Equal To(==)
  2. Not Equal To(!=)
  3. Greater Than(>)
  4. Less Than(<)
  5. Greater Than or Equal To(>=)
  6. Less Than or Equal To(<=)

Equal To(==)

Equal to operator checks if two values or equal or not. If both values are equal then it returns True else False.

a=100
b=120
print(a == b)
Output
False

Not Equal To(!=)

Not Equal To checks if two values are equal or not. If two values are not equal then it returns True else returns False.


a=45
b=64
print(a != b)
Output
True

Greater Than(>)

Greater Than checks if the right operand is greater than the left operand . If the right operand is greater than left then it returns True else returns False.


a=65
b=74
print(a &gt b)
Output
False

less Than(<)

Less Than checks if the right operand is lesser than the left operand then it returns True and returns False.


a=85
b=985
print(a &lt b)
Output
True

Greater Than or Equal To(>=)

Greater Than or Equal To operator checks if the right operand is greater or equal to the left operand. If the right operand is greater than or equal to left operand it returns True else returns False.


a=75
b=75
print(a &gt= b)
Output
True

Less Than or Equal To(<=)

Less Than or Equal To returns True if the right operand is less than or equal to the left operand else it returns False.
a=85
b=64
print(a &lt= b)
Output
False

0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top