Logical Operators in python [hat are logical operators examples?]

OperatorDescriptionExample
andReturns True if both statements are truex < 5 and  x < 10
orReturns True if one of the statements is truex < 5 or x < 4
notReverse the result, returns False if the result is truenot(x < 5 and x < 10)
# Logical Operator
a = True
b = False

# Print a and b is False
print(a and b)

# Print a or b is True
print(a or b)

# Print not a is False
print(not a)

Output:
False
True
False

Keywords:

Logical Operators in python,
What are the 3 logical operators in Python?
What are logical operators examples?
What are the 5 logical operators?
Why do we use logical operators in Python?
relational operators in python,
logical operators in python with example,
logical operators in python w3schools,
comparison operators in python,
logical operators in python symbol,
operator in python,
assignment operators in python,
arithmetic operators in python,

Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top