Page 40 - 2501_KVS_C-8
P. 40
3 LOGICAL OPERATORS
IN PYTHON
Your Aim
3.1 Introduction to Logical Operators
3.2 Types of Logical Operators NOT, AND,
OR
3.3 Use of "Range()" Function
3.1 INTRODUCTION TO LOGICAL OPERATORS
Dear students, today we shall discuss something about the logical operators in python and
its applications in solving a variety of real world problems. We can program mainly those
applications that involve the reverse of a given statement/condition or which involves two
or more than two conditions. Some of the examples of such applications are:
(a) We have to print the age of Rama if he is not studying in class 8th. This example
involves the reverse or negation of a statement/condition.
(b) Or we have to print the age of Rama only if he is studying in class 8th and his/her age
is more than 13 years and many more like this.
(c) Or we have to print the age of Rama if he is studying in class 8th or his/her age is more
than 13 years and many more like this.
Let us now discuss how we can program such applications using the logical operators.
3.2 TYPES OF LOGICAL OPERATORS NOT, AND, OR
Python supports three (03) types of logical operators as are used in almost all the available
programming languages. These are:
1. AND Operator (and)
2. OR Operator (or)
3. NOT Operator (not)
NOT operator: “not” operator functions on a single (01) operand/condition/expression.
It reverses the current status(either True or False) of a statement i.e. if the value
of the whole statement/expression is True then it will give an answer False and vice-
versa. It can be used in python by the keyword “not”.
38 KVS DELHI REGION 2025

