Articles → Python → Logical Operators In Python

Logical Operators In Python






Logical Operators




  1. And
  2. Or
  3. Not

And Operator




Condition 1 and condition 2






age = 19
nationality = "indian"

# If you are above 18 years of age and your nationality is indian then you are eligible to vote.

if age > 18 and nationality == "indian":
        print("You are eligible to vote")




Picture showing the output of the And operator in python



Or Operator




Condition 1 or condition 2




isAmazonEmployee = False
isPrimeMembershipHolder  = True

# If you are an amazon employee or have amazon prime membership then you can watch that movie

if isAmazonEmployee ==True or isPrimeMembershipHolder == True:
        print("You are eligible to watch the movie")




Picture showing the output of the Or operator in python



Not Operator






Picture showing the output of the Not operator in python



Posted By  -  Karan Gupta
 
Posted On  -  Sunday, February 17, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250