2.3.4 Logical Operators
Python Programming
Logical operators are used to combine multiple conditions or expressions in a program. The most common logical operators are and. or, and not. They are used to perform logical operations and return Boolean values based on the evaluation of the expressions involved.
python
# Define variables
x = True
y = False
# Logical AND
logical_and = x and y
print(x , "and ", y ,"=", logical_and) # Output: True and False =False
# Logical OR
logical_or = x or y
print(x , "or "