Page 109 - TP-Play_V-2.0_Book-8
P. 109

D.  Short answer type questions:
                1.  What is looping?

                   ...................................................................................................................................................................................................
                2.  Write the syntax of the for loop.

                   ...................................................................................................................................................................................................
                3.   What is the use of Jump statement?
                   ...................................................................................................................................................................................................

            E.  Long answer type questions:

                1.  Draw the flowchart of the for loop.
                2.  Define the use of while statement with the help of example and flowchart.

                3.   Distinguish between continue and break statements.

            F.  Write the output of the following programs:
                1.  x = 1                                           2.  i = 2
                  sum=0                                               while True:
                  while(x<=10):                                           if i%3 == 0:
                      sum=sum+x                                               break
                       x=x+1                                              print(i)
                  print (sum)                                             i += 2
                                                                                       21 st
            G.  Competency-based/Application-based question:                        Century   #Experiential Learning
                                                                                      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   #Computational Thinking
                                                                                   Century
                                                                                     Skills  #Productivity & Accountability
                                                   In the lab


               Write a program to:
                   determine whether a given number is an Armstrong number or not.
                  use the for loop to print the numbers 8, 11, 14, 17, 20, ... , 83, 86, 89.
                  use the for loop to print the numbers 100, 98, 96, ... , 4, 2.
                  print 1 to 100 using while loop.
                   find out the sum of numbers within the range 1 to 100 using while loop.

                  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      109
   104   105   106   107   108   109   110   111   112   113   114