Page 101 - Code_GPT_Class_8
P. 101
I have finished Cool! So, you have
15 by now. become a Python pro!
Test Your Knowledge 21 st Century #Critical Thinking
Skills
State true or false.
1. Python does not support conditional statements.
2. We can use if statement inside other if statement.
3. We can check multiple conditions in Python.
Sometimes, you need to repeat a task multiple times or you may need to repeat the task either a certain
number of times or until a condition is satisfied. In Python, the statements that are used to repeat a
set of instructions are called iterative or looping statements. Looping statements are very useful and
necessary for developing applications.
Python provides two types of looping statements—for and while. The for statement is used to repeat
an instruction or a set of instructions for a fixed number of times. Whereas, the while statement is used
to repeat a set of instructions until a condition evaluates to true. Let’s discuss these constructs in brief.
THE FOR LOOP
The for loop executes a simple or compound statement for a fixed number of times, i.e looping a set
of instructions for a specified number of times. For loop first initialises the counter variable once, then
it checks the range if within range it executes the statement within for loop and then increments or
decrements the counter variable as specified by step_size. The syntax of the for statement is given
below:
for <counter variable> in range(start, stop, step_size):
Statements
Loops in Python 99

