Page 267 - Computer Science Class 11 With Functions
P. 267

(xi)

                  num = 2
                  upperLimit = 300
                  while num <= upperLimit:
                      num += num
                  print(num)
             Ans.  512
                  (xii)

                  num = 0
                  total = 0
                  upperLimit = 20
                  while num <= upperLimit:
                      num += 2
                      total = total + num
                  print(num, total)
             Ans. 22 132
                  (xiii)
                  num = 0
                  total = 0
                  upperLimit = 20
                  while num <= upperLimit:
                      total = total + num
                      num += 2
                   print(num, total)
             Ans.  22 110
                  (xiv)
                  while(3>2):
                      print('Yes', end='')
                  else:
                      print('Tried', end = '')
             Ans.  Infinite loop
                  YesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYes …
                  (xv)
                  for i in range(1, 5):
                      for col in range(6, 10):
                          print(i*col, end=' ')
                  print()
             Ans.  6 7 8 9 12 14 16 18 18 21 24 27 24 28 32 36
                  (xvi)

                    for i in range(1,5):
                        pass
                        print(i, end='')
                    print('NO OUTPUT')

             Ans. 1234NO OUTPUT







                                                                                              Looping in Python  265
   262   263   264   265   266   267   268   269   270   271   272