j33vansh

Answer 3 Looping Py

Jun 26th, 2021
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1.  
  2. while currRow <= firstHalf:
  3.     spaces = 1
  4.     while spaces <= (firstHalf - currRow):
  5.         print(" ", end="")
  6.         spaces += 1
  7.     currCol = 1
  8.     while currCol <= (2 * currRow) - 1:
  9.         print("*", end="")
  10.         currCol += 1
  11.     print()
  12.     currRow += 1
  13.  
  14. currRow = secondHalf
  15.  
  16. while currRow >= 1:
  17.     spaces = 1
  18.     while spaces <= (secondHalf - currRow + 1):
  19.         print(" ", end="")
  20.         spaces += 1
  21.  
  22.     currCol = 1
  23.     while currCol <= (2 * currRow) - 1:
  24.         print("*", end="")
  25.         currCol += 1
  26.     print()
  27.     currRow -= 1
  28.  
Advertisement
Add Comment
Please, Sign In to add comment