Logical Operators
In Python, Logical operators are used on conditional statements (either True
or False
). They perform Logical AND
, Logical OR
and Logical NOT
operations.
Example 1: Logical operators in Python
Output:
and
will result into True
only if both the operands are True
The truth table for and
is given below:
or
will result into True
if any of the operands is True
.
The truth table for or is given below:
not
operator is used to invert the truth value.
The truth table for not
is given below:
some example of their usage are given below
Last updated