The logical operators are used primarily in the expression
evaluation to make a decision. Python supports the following logical operators.
Operator
|
Description
|
and
|
If both the expression
are true, then the condition will be true. If a and b are the two expressions,
a → true, b → true => a and b → true.
|
or
|
If one of the expressions
is true, then the condition will be true. If a and b are the two expressions,
a → true, b → false => a or b → true.
|
not
|
If an expression a is true then not
(a) will be false and vice versa.
|
0 comments:
Post a Comment