fork download
  1. rows = 5
  2. i = 1
  3. while i <= rows:
  4. j = i
  5. while j < rows:
  6. # display space
  7. print(' ', end=' ')
  8. j += 1
  9. k = 1
  10. while k <= i:
  11. print('*', end=' ')
  12. k += 1
  13. print()
  14. i += 1
  15.  
  16. i = rows
  17. while i >= 1:
  18. j = i
  19. while j <= rows:
  20. print(' ', end=' ')
  21. j += 1
  22. k = 1
  23. while k < i:
  24. print('*', end=' ')
  25. k += 1
  26. print('')
  27. i -= 1
Success #stdin #stdout 0.03s 9604KB
stdin
Standard input is empty
stdout
        * 
      * * 
    * * * 
  * * * * 
* * * * * 
  * * * * 
    * * * 
      * * 
        *