Page 81 - TP_V5.1_C8_fb
P. 81
2. Fill in the blanks using the words from the help box.
while, indented, continue
a. The statements inside the loop must be _____________ properly.
b. In the _____________ loop, the condition is checked first.
c. The _____________ statement causes the program to skip the rest of the statements in the current
block and to move to next iteration of the loop.
3. Answer in one or two words.
a. Name any one iterative statement. ____________
b. Which function is used to generate a list of numbers? ____________
c. Which loop is used when the number of iterations is not known? ____________
4. Think and answer.
a. What is Iteration?
______________________________________________________________________________________
b. Differentiate between for and while loop.
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
c. Write the syntax of the following:
(i) while loop
______________________________________________________________________________________
______________________________________________________________________________________
(ii) range function
______________________________________________________________________________________
______________________________________________________________________________________
d. What are jump statements? Give an example for each of them.
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
______________________________________________________________________________________
5. Write the output of the following programs:
a. sum1=0
n = int(input("Please enter number"))
for i in range(1, n+1, 1):
sum1 += i
print("Sum is: ", sum1)
Iterations in Python 79

