fork download
  1. def diamond4(n):
  2. l = []
  3. l.append('*' * n)
  4. for i in range(n - 2, 0, -2):
  5. s = ' ' * ((n - i) / 2) + '*' * i
  6. l.insert(0, s)
  7. l.append(s)
  8. print '\n'.join(l)
  9.  
  10. diamond4(5)
  11. diamond4(7)
  12.  
Success #stdin #stdout 0.07s 8888KB
stdin
Standard input is empty
stdout
  *
 ***
*****
 ***
  *
   *
  ***
 *****
*******
 *****
  ***
   *