There are
following logical operators supported by Python language.
Assume
variable a holds 10 and variable b holds 20 then:
Operator
|
Description
|
Example
|
and
|
Called Logical AND operator. If both the operands are true then
condition becomes true.
|
(a and b) is true.
|
Or
|
Called Logical OR Operator. If any of the two operands are non-zero
then condition becomes true.
|
(a or b) is true.
|
not
|
Called Logical NOT Operator. Use to reverses the logical state of its
operand. If a condition is true then Logical NOT operator will make false.
|
not (a and b )is false.
|
No comments:
Post a Comment