Page 47 - Modular v1.1 Pyhton
P. 47

Program 7: To demonstrate the use of the break statement in a loop.















                 On running the above program, you will get the following output:


























                 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.




















                                                                                  Looping Statements in Python    45
   42   43   44   45   46   47   48   49   50   51   52