I am trying to achieve this
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6
0 1 2 3 4 5
0 1 2 3 4
0 1 2 3
0 1 2
0 1
0
And I'm getting close but now I'm stuck. Here is my current code
def triangle():
n = 9
numList = [0,1,2,3,4,5,6,7,8,9]
for i in range(10):
for i in numList:
print(i, end=" ")
print()
numList[n] = 0
n -= 1
triangle()
And this is the current output
0 1 2 3 4 5 6 7 8 9
0 1 2 3 4 5 6 7 8 0
0 1 2 3 4 5 6 7 0 0
0 1 2 3 4 5 6 0 0 0
0 1 2 3 4 5 0 0 0 0
0 1 2 3 4 0 0 0 0 0
0 1 2 3 0 0 0 0 0 0
0 1 2 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
So I'm there in a round about way, except, its backwards, and there is 0's instead of spaces
0s come from and do something about it?numList[n] = 0-->numList.pop()for example.