Page 120 - 2620_Birla Open Mind C-8
P. 120

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")





                   SOME MORE PROGRAMS


              Program 9: To create a number pattern using for loop


                   Program9.py
               File  Edit  Format    Run   Options   Window    Help

                #Program to create number pattern using for loop


                for i in range(1,10):
                    print('3' * i)




              You will get the following output:

                   Output

                3
                33
                333
                3333
                33333
                333333
                3333333
                33333333
                333333333











                  118  Premium Edition-VIII
   115   116   117   118   119   120   121   122   123   124   125