Logical Operators
Operator
Meaning
Example
Example 1: Logical operators in Python
x = True
y = False
print(f'x and y is {x and y}')
print(f'x or y is {x or y}')
print(f'not x is {not x}')x and y is False
x or y is True
not x is FalseA
B
A and B
A
B
A or B
A
not A
Last updated