Professional Documents
Culture Documents
Python Programming
Using Problem Solving Approach
Reema Thareja
A control statement is a statement that determines the control flow of a set of instructions, i.e., it decides the
sequence in which the instructions in a program are to be executed.
Example:
Example:
Example:
Example:
Example:
Examples:
10
Examples:
11
12
Example:
13
Example:
14
15
16
Unlike C and C++, in Python you can have the else statement associated with a loop statements. If the else statement
is used with a for loop, the else statement is executed when the loop has completed iterating. But when used with the
while loop, the else statement is executed when the condition becomes false.
Examples:
17