Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Notes

Python Logical Operators

 

 

Logical operators perform Logical AND, Logical OR, and Logical NOT operations.

Example:

 

# Examples of Logical Operator 
x = True
y = False
 
# Print x and y is False 
print(x and y) 
 
# Print x or y is True 
print(x or y) 
 
# Print not x is False 
print(not x)

 

output:

 

False
True
False