I'm trying to create a triangle like the following:
1 2 3 4 5 6
2 3 4 5 6
3 4 5 6
4 5 6
5 6
6
Without using while, for in, lists, etc. Just "if-else" cases and recursive functions. I've just learned how to do an asterisk triangle.
def triangle(i, t=0):
if i == 0:
return ' '
else:
print '*' * i
return triangle( i - 1, t + 1 )
triangle(6)
It has the same idea I want to apply to my exercise, but I really don't know how to do with the code for changing term by term and print them all to the right like this one.