Page 113 - TP_Pluse_V2.2_Class_6
P. 113
Operator Name Description Example Output
(x=8 and y=6)
< Less than It checks if the value of left operand is less x < y FALSE
than the value of right operand. If yes, then
the condition becomes true.
>= Greater It checks if the value of left operand is greater x >= y TRUE
than or than or equal to the value of right operand. If
equal to yes, then the condition becomes true.
<= Less than It checks if the value of left operand is less x <= y FALSE
or equal to than or equal to the value of right operand. If
yes, then the condition becomes true.
Program 4: To show all the relational operators’ functions
Program4.py
File Edit Format Run Options Window Help
#Program to perform Relational Operators
a = 11
b = 32
Output
print (a > b)
False
print (a < b)
True
print (a == b)
False
print (a != b)
True
print (a >= b)
False
print (a <= b)
True
PRECEDENCE OF OPERATORS
Precedence of operators determines the order in which the operators are executed. The operator
precedence in Python is listed in the following table. The highest precedence is at the top.
Operator Name
() Parenthesis
** Exponent
*, /, %, // Multiplication, Division, Modulo, Floor Division
+, – Addition, Subtraction
==, !=, >, <, >=, <= Relational
=, +=, -=, *=, /=, %=, **=, //= Assignment
and, or, not Logical
Introduction to Programming 111

