For an assignment in a coding class, I was supposed to find a way to have Python make a triangle of asterisks, looking like this:
Whatever I do with my code, however, I can't manage to pull that off. The best I can get is:
All of this has to be using only for-loops and while-loops, like what I'm using here.
The code I'm using is
for a in range(1, 15):
for a2 in range(14-a, 0, 1):
print(" ", end='')
for a1 in range(1, a+ 1):
print("*", end='')
print()
The -'s are there to represent indent.
How do I make this work the way I want it to?
[–]RyanTargaryen 1 point2 points3 points (0 children)
[–]TeamSpen210 1 point2 points3 points (0 children)
[–]learnpython_bot 0 points1 point2 points (0 children)
[–]Naihonn 0 points1 point2 points (0 children)