Python 3 - Logical Operators Example


Advertisements

There are following logical operators supported by Python language. Assume variable a holds True and variable b holds False then

OperatorDescriptionExample
and Logical AND If both the operands are true then condition becomes true. (a and b) is False.
or Logical OR If any of the two operands are non-zero then condition becomes true. (a or b) is True.
not Logical NOT Used to reverse the logical state of its operand. Not(a and b) is True.
python_basic_operators.htm
Advertisements