Page 110 - TP_Play_V2.2_Class8
P. 110
Timeline
Looping statements are very useful and necessary for developing applications.
Python provides two types of looping statements—for and while.
The for statement executes a simple or compound statement for a fixed number of times.
The range() function is an in-built function of Python.
A sequence is a succession of values bound together by a single name.
The while statement executes a set of statements repeatedly, until the logical expression evaluates
to true.
To come out of the infinite loop, we can either close the program window or press Ctrl + C.
Choose the correct option.
1. What does while loop do?
a. Repeats a chunk of code a given number of times
b. Repeats a chunk of code until a condition is true
c. Repeats a chunk of code until a condition is false
d. Repeats a chunk of code indefinitely
2. Which of the following is/are a looping statement/statements in Python?
a. for statement b. while statement
c. break statement d. Both a. and b.
3. Which of the following statements allow/allows to repeat a task for a fixed number of times?
a. for statement b. if statement
c. continue statement d. Both a. and b.
4. Which of the following statements terminates the execution of the loop?
a. if b. for
c. break d. continue
Fill in the blanks with the correct words.
Hints infinite, break, while, continue, non-zero, false
1. The statement executes a set of statements repeatedly, until the logical
expression remains true.
108 Plus (Ver. 4.0)-VIII

