Page 127 - TP_Play_V2.1_class8
P. 127
F. Write the output of the following programs:
1. x = 1
sum=0
while(x<=10):
sum=sum+x
x=x+1
print (sum)
2. i = 2
while True:
if i%3 == 0:
break
print(i)
i += 2
21 st #Technology Literacy
G. Competency-based/Application-based question. Century #Critical Thinking
Skills
Your brother Atharv wants to write a statement which will cause the program to skip the
rest of the statement of the current block and to move to the next iteration of the loop.
But he is unable to do it. Suggest the statement he should use for this.
21 st #Technology Literacy
Century #Critical Thinking
Skills
In the lab
Write a program:
To print multiplication table of any given number using for loop.
To count number of vowels in a given string.
To determine whether a given number is an Armstrong number or not.
To use the for loop to print the numbers 8, 11, 14, 17, 20, ... , 83, 86, 89.
To use the for loop to print the numbers 100, 98, 96, ... , 4, 2.
To print 1 to 100 using while loop.
To find out the sum of numbers within the range 1 to 100 using while loop.
To calculate the sum of first ten even numbers by using the while loop and the for loop.
Teacher's Corner
1. Discuss about all the looping statements of Python with the students.
2. Go through all the topics covered in this chapter.
Loops in Python 125

