I need to write a code that inputs a non-right Pascal's triangle given the nth level as an input where the first row is the 0th level. Apart from that, at the end of each row the level must be indicated. Here's what I've made so far:
level = input('Please input nth level: ')
x = -1
y = 1
while x < level:
x = x+1
d = str(11**x)
while y < level:
y = y+1
print " ",
for m,n in enumerate(d):
print str(n) + " ",
while y < level:
y = y+1
print " ",
print x
When I input 3, it outputs:
1 0
1 1 1
1 2 1 2
1 3 3 1 3
My desired output is:
1 0
1 1 1
1 2 1 2
1 3 3 1 3