Page 105 - Plus V4 with Adobe class 8
P. 105

The Continue Statement


            The continue statement is used inside loops. When a continue statement is encountered inside a loop,
            control of the program jumps to the beginning of the loop for next iteration, skipping the execution of
            rest of the statements of the loop for the current iteration.

            Syntax:
            #loop statements
                 continue
            #the code to be skipped
             Program 8: To demonstrate the use of the continue statement in a loop.
















            On running the program, we get the following output:





















                     Double Tap                                                   Century   #Critical Thinking
                                                                                    21 st
                                                                                   Skills

                   What will be the output of the given Python code?
                   a.   i = 0
                       while (i == 0): print(“Hello Touchpad”)

                   b.   i = 1
                       while (i<=5):
                         print("i=",i)
                         i+=1
                       print("Done")






                                                                                              #Loops in Python 103
   100   101   102   103   104   105   106   107   108   109   110