Articles → Python → Logical Operators In Python
Logical Operators In Python
Logical Operators
- And
- Or
- 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")
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")
Not Operator