December 2000
Intermediate to advanced
816 pages
16h 57m
English
The if statement for Python will seem amazingly familiar; it is made up of three main components: the keyword itself, an expression which is tested for its truth value, and a code suite to execute if the expression evaluates to non-zero or true. The syntax for an if statement:
if expression: expr_true_suite
The suite of the if clause, expr_true_suite, will be executed only if the above conditional expression results in a Boolean true value. Otherwise, execution resumes at the next statement following the suite.
The Boolean operators and, or, and not can be used to provide multiple conditional expressions or perform negation of expressions in the same if statement.
if not warn and ...
Read now
Unlock full access