Python Free Tutorial

Operator :  Meaning                                           Example
and     True if both the operands are true                        x and y
or      True if either of the operands is true                    x or y
not     True if operand is false (complements the operand)        not x

Lets go with some examples of logical operator in python :

>>> a = True
>>> b = False
>>> print(('a and b is',a and b))
>>> print(('a or b is',a or b))
>>> print(('not a is',not a))

& Here is the output :

('a and b is', False)
('a or b is', True)
('not a is', False)

This page is contributed by Diwas & Sunil . If you like AIHUB and would like to contribute, you can also write an article & mail your article to  itsaihub@gmail.com . See your articles appearing on AI HUB platform and help other AI Enthusiast.

About Diwas Pandey

Highly motivated, strong drive with excellent interpersonal, communication, and team-building skills. Motivated to learn, grow and excel in Data Science, Artificial Intelligence, SEO & Digital Marketing

View all posts by Diwas Pandey →


  1. I do not even know how I finished up right here, but I assumed this publish was good.
    I don’t recognise who you’re but definitely you’re going to a well-known blogger
    should you are not already. Cheers!

Leave a Reply

Your email address will not be published.