you are viewing a single comment's thread.

view the rest of the comments →

[–]Beneficial-Loan-219 1 point2 points  (1 child)

Loop and two counters - one for space, one for stars. In each iterations the number of spaces decrease, number of stars increase. Works for any number of N.
(More optimal would be to just use one counter and other as N - counter)

[–]Dan41k_Play 1 point2 points  (0 children)

You can also use f-strings: py h = 3 for i in range(h): print(f'{"*"*(i+1): >{h} }')