fork download
  1. rows = 5
  2. for i in range(0, rows):
  3. for j in range(0, i + 1):
  4. print("*", end=' ')
  5. print("\r")
  6.  
  7. for i in range(rows, 0, -1):
  8. for j in range(0, i - 1):
  9. print("*", end=' ')
  10. print("\r")
  11.  
  12. i = 1
  13. while i <= rows:
  14. j = i
  15. while j < rows:
  16. print(' ', end=' ')
  17. j += 1
  18. k = 1
  19. while k <= i:
  20. print('*', end=' ')
  21. k += 1
  22. print()
  23. i += 1
  24.  
  25. i = rows
  26. while i >= 1:
  27. j = i
  28. while j <= rows:
  29. print(' ', end=' ')
  30. j += 1
  31. k = 1
  32. while k < i:
  33. print('*', end=' ')
  34. k += 1
  35. print('')
  36. i -= 1
Success #stdin #stdout 0.04s 9644KB
stdin
Standard input is empty
stdout
* 
* * 
* * * 
* * * * 
* * * * * 
* * * * 
* * * 
* * 
* 

        * 
      * * 
    * * * 
  * * * * 
* * * * * 
  * * * * 
    * * * 
      * * 
        *