February 2006
Intermediate to advanced
648 pages
14h 53m
English
The if, else, and elif statements control conditional code execution. The general format of a conditional statement is as follows:
if expression: statements elif expression: statements elif expression: statements ... else: statements
If no action is to be taken, you can omit both the else and elif clauses of a conditional. Use the pass statement if no statements exist for a particular clause:
if expression:
pass # Do nothing
else:
statementsRead now
Unlock full access