LOGICAL OPERATOR IN PYTHON

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

🚀 I'm Diwas Pandey, a Computer Engineer with an unyielding passion for Artificial Intelligence, currently pursuing a Master's in Computer Science at Washington State University, USA. As a dedicated blogger at AIHUBPROJECTS.COM, I share insights into the cutting-edge developments in AI, and as a Freelancer, I leverage my technical expertise to craft innovative solutions. Join me in bridging the gap between technology and healthcare as we shape a brighter future together! 🌍🤖🔬

View all posts by Diwas →

2 Comments on “LOGICAL OPERATOR IN PYTHON”

  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. Required fields are marked *