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