python7
python7
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
and
or
not
Gives
Code
PYTHON
Output
True
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))
Output
True
Logical OR Operator
Gives
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))
(2 < 3) or (2 < 1)
True or (2 < 1)
True or False
Output
True
Code
PYTHON
1 print(not(False))
Output
True
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
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