Write a nested for loop that displays the following outpout:
1
1 2 1
1 2 4 2 1
1 2 4 8 4 2 1
1 2 4 8 16 8 4 2 1
1 2 4 8 16 32 16 8 4 2 1
1 2 4 8 16 32 64 32 16 8 4 2 1
1 2 4 8 16 32 64 128 64 32 16 8 4 2 1
What I have so far is as follows:
for i in range(1, 8 + 1):
for j in range(i, 0, -1):
print(j),
print("")
which outputs:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
7 6 2 4 3 2 1
8 7 6 5 4 3 2 1
Any guidance is appreciated.