Page 93 - ThinkGPT_V2.1_C8_Flipbook
P. 93

Some More Programs

                 Program: To print a pattern using while loop.




                                                                              A loop repeatedly executes a block
                                                                              of code, just as a flock of Starlings
                                                                               (birds) repeatedly adjusts their
                                                                                          formation.




















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





















                 Program: To add first five natural numbers.













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












                                                                                Looping Statements in Python   91
   88   89   90   91   92   93   94   95   96   97   98