I am using nested loops to create a reverse triangle that goes down by whatever character amount I enter. For example, if 8 is entered, my triangle is supposed to look like this
xxxxxxxx
xxxxxxx
xxxxxx
xxxxx
xxxx
xxx
xx
x
My code currently consists of whats below, but the output is not what I was looking for.
row = 1
while row <= size:
# Output a single row
col = size - row + 1
while col <= size:
# Output the drawing character
print(end=' ')
# The next column number
col = col + 1
col = 0
while col <= size - row:
print(drawingChar, end=' ')
col = col + 1
row = row + 1
print()
print()
Output:
x x x x x x x x
x x x x x x x
x x x x x x
x x x x x
x x x x
x x x
x x
x
Im sure i screwed up something minor with my <= size or col somewhere. All input is appreciated.
endparameter in the secondwhileloop:print(drawingChar, end='')end=' ')that you should remove, that's all