Python Logical Operators

There are following logical operators supported by Python language. Assume variable a holds 10 and variable b holds 20 then −

Sr.NoOperator & DescriptionExample
1and Logical AND
If both the operands are true then condition becomes true.
(a and b) is true.
2or Logical OR
If any of the two operands are non-zero then condition becomes true.
(a or b) is true.
3not Logical NOT
Used to reverse the logical state of its operand.
Not(a and b) is false.