Skip to main content

Python: Logical Operators

Logical Operators are used to perform logical operation between two given conditional statements.

Operator Description Syntax
and It will return True, if both statements are true. a and b
or It will return True, if one of the statements is true. a or b
not It reverse the result, returns False if the result is true. not a


a = 5
print(a < 6 and a < 7)
print(a > 6 and a < 8)
print(not(a < 6))


Submitted by devanshi.srivastava on June 25, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.


At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.