...
/Logical Expression and Short-Circuit Evaluation
Logical Expression and Short-Circuit Evaluation
Explore the logical operators in Python and their use as short-circuit evaluators.
We'll cover the following...
Logical expressions
We can create a compound expression by combining logical operations. De Morgan’s laws are based on this paradigm. Consider the following expression:
not(a or b)
The compound expression above is true or false depending on different combinations. If a
and b
are false, the negation of subexpression (a or b)
is true. If any one of them is true, then the value will be false, and this combination might take different shapes according to the truth table.
A major part of discrete mathematical operations is based on Boolean algebra and the associated logical expressions. To recap, we need to remember that there are three basic logical operators. The following ...