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

You will get the following output:


















            Program 10: To print the given stars














            You will get the following output:





















               Recap


                    Looping statements are very useful and necessary for developing applications.
                    The for statement executes a simple or compound statement for a fixed number of times.

                   The range() function is an in-built function of Python.
                    A sequence is a succession of values bound together by a single name.
                    The while statement executes a set of statements repeatedly, until the logical expression
                   evaluates to true.
                    The break keyword in Python is used for bringing the program control out of the loop.

                    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.



                                                                                       Loops in Python      107
   102   103   104   105   106   107   108   109   110   111   112