DECISION STRUCTURE
IF
Programs require a different type of control structure:
- Sequence structure
- Decision structures or selection structures
- .....
The if statement is used to create a decision structure, which allows a
program to have more than one path of execution. The if statement causes
one or more statements to execute only when a Boolean expression is true.
For simplicity, we will refer to the first line as the if clause. The if clause
begins with the word if, followed by a condition, which is an
expression that will be evaluated as either true or false. A colon
appears after the condition. Beginning at the next line is a block of
statements. A block is simply a set of statements that belong
together as a group. Notice in the general format that all of the
statements in the block are indented. This indentation is required
because the Python interpreter uses it to tell where the block begins
and ends.