7/27/24, 8:59 PM Revolutionizing the Job Market | NxtWave
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=3e422df5-… 1/5
7/27/24, 8:59 PM Revolutionizing the Job Market | NxtWave
Logical Operators
The logical operators are used to perform logical operations on Boolean
values.
Gives
True or False as the result.
Following are the logical operators
and
or
not
Logical AND Operator
Gives
True if both the booleans are true else, it gives False
Code
PYTHON
1 print(True and True)
Output
True
Examples of Logical AND
Code
PYTHON
1 i t((2 3) d (1 2))
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=3e422df5-… 2/5
7/27/24, 8:59 PM Revolutionizing the Job Market | NxtWave
1 print((2 < 3) and (1 < 2))
Step by Step Explanation
(2 < 3) and (1 < 2)
True and (1 < 2)
True and True
Output
True
Logical OR Operator
Gives
True if any one of the booleans is true else, it gives False
Code
PYTHON
1 print(False or False)
Output
False
Examples of Logical OR
Code
PYTHON
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=3e422df5-… 3/5
7/27/24, 8:59 PM Revolutionizing the Job Market | NxtWave
1 print((2 < 3) or (2 < 1))
Step by Step Explanation
(2 < 3) or (2 < 1)
True or (2 < 1)
True or False
Output
True
Logical NOT Operator
Gives the opposite value of the given boolean.
Code
PYTHON
1 print(not(False))
Output
True
Examples of Logical NOT
Code
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=3e422df5-… 4/5
7/27/24, 8:59 PM Revolutionizing the Job Market | NxtWave
PYTHON
1 print(not(2 < 3))
Step by Step Explanation
not(2 < 3)
not(True)
False
Output
False
Summary
1. Logical AND Operator gives True if all the booleans are true.
2. Logical OR Operator gives True if any of the booleans are true.
3. Logical NOT Operator gives the opposite value
https://learning.ccbp.in/course?c_id=a6454e48-d030-4d49-8920-253198052232&t_id=36b50c7e-806a-4834-859f-1c031bdf9942&s_id=3e422df5-… 5/5