Logical Operators in python
Logical operators are used to combining more than two conditional statements.
These operators are very useful for writing logical conditions in control flow statements of a programming language.
Let’s code them one by one.
and operator
- and operator return the boolean value
Trueonly if both statements are true.
Output:
True
or operator
- or operator returns the boolean value
Trueif any statement is true.
Output:
True
not operator
- not-operator acts as a unary operator which returns the boolean value
Truethe statement is true and vice versa.
Output:
False