Operator | Description | Example |
and | Returns True if both statements are true | x < 5 and x < 10 |
or | Returns True if one of the statements is true | x < 5 or x < 4 |
not | Reverse the result, returns False if the result is true | not(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,