Page 322 - Computer Science V2.0 Class 11
P. 322

29                 print(' ', end = '')
                30         print()
                31 hollowDiamond(11,'*')
              Sample Output:

                         *
                        * *
                       *   *
                      *     *
                     *       *
                    *         *
                     *       *
                      *     *
                       *   *
                        * *
                         *
              Fig 11.11: Hollow Diamond

              Partial Dry Run

              i = 1
                  print 6-1=5 spaces
                  j = 1
                      print one *
                  print newline
              i = 2
                  print 6-2=4 spaces
                  j = 1
                      print one *
                  j = 2
                      print one space
                  j = 3
                      print one *
                  print newline
              i = 3
                  print 6-3=3 spaces
                  j = 1
                      print one *
                  j = 2
                      print one space
                  j = 3
                      print one space
                  j = 4
                      print one space
                  j = 5
                      print one *
                  print newline
              and so on
              11.8 Infinite Loop

              A while loop becomes an infinite loop if the test condition never yields False. For example,

              while True:
                  s = 1
                  print(s)



               308   Touchpad Computer Science (Ver. 2.0)-XI
   317   318   319   320   321   322   323   324   325   326   327