Page 231 - Ai_V1.0_Class9
P. 231
Following relational operators are provided by Python:
Name Symbol Purpose Example Output
a = 5
Returns True if both the values are
Equal to == b = 10
same otherwise False.
a == b False
a = 5
Returns True if both the values are
Not equal to != b = 10
different otherwise False.
a != b True
a = 5
Returns True if first value is greater
Greater than > b = 10
than second value otherwise False.
a > b False
a = 5
b = 10
a < b True
Returns True if the first value is less "abc" > "aBc" True
Less than <
than second value otherwise False.
"67" > "621" True
(string value are
compared using
ASCII code)
a = 5
Returns True if the first value is
Greater than or >= greater than or equals to the b = 10
equal to
second value otherwise False.
a >= b False
a = 5
Returns True if the first value is less
Less than or <= than or equals to the second value b = 10
equal to
otherwise False.
a <= b True
Brainy Fact
Python uses ASCII/Unicode character set. ASCII Stands for "American Standard Code for
Information Interchange." It is a character encoding standard that uses numerical codes to
represent characters in uppercase and lowercase, numbers and punctuation symbols. ASCII
values of capital letters A–Z are 65 to 90, small letters are 97 to 122 and numbers 0 to 9 are 48
to 57.
Logical Operators
Logical operators are used to combine one or more conditional statements and returns either True or False
based on the evaluation of the conditions.
Introduction to Python 229

