Page 226 - Computer Science Class 11 Without Functions
P. 226

28     print(' ' * (nInverted-i+1), end = '')
          29
          30     for j in range(1, 2*i):
          31         if j==1 or j==2*i-1:
          32             print(symbol, end = '')
          33         else:
          34             print(' ', end = '')
          35     print()
        Sample Output:

         >>> Enter the number of rows (odd number): 11
         >>> Enter Symbol: *
                   *
                  * *
                 *   *
                *     *
               *       *
              *         *
               *       *
                *     *
                 *   *
                  * *
                   *
        9.7.4 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


         224   Touchpad Computer Science-XI
   221   222   223   224   225   226   227   228   229   230   231