Pascal triangle with pattern

how am i able to use for loops in order to create diamond shape:

     *
    *  *
   *    *
    *  *
      *
Count how many spaces each line have. In this case it is 5,*; 4,*,2; 3,*,4; 4,*,2; 6,*;. Try to express these numbers in functions of n (total number of lines) and i (number of the current line). There are just linear functions, so you shouldn't have problems with it.
Notice that you can use one set of functions to draw first 3 lines, and use another set for the rest or etc.
how about the middle one...it is white space....i want to try use for loop to create a diamond shape like that...
What about the middle one? All internal lines have white spaces. Your algorithm for the middle line will be
print ' ' 3 times
print '*'
print ' ' 4 times
print '*'
print '\n'

And of course you will be doing this all in a for loop.
Last edited on
well...thanks for your help !!
Topic archived. No new replies allowed.