I am trying to make a program that will print a pattern such as:
n = 4
1
12
123
1234
Right now this is what I have:
n = int(input("Please enter a positive integer: "))
line = ""
for currentNum in range(1,n+1):
line = " " * (n-currentNum) + line + str(currentNum)
print(line)
I am not getting the right amount of spaces that I'm hoping that I would get. Any tips? Thanks.
This is what I'm getting on IDLE:
1
12
123
1234
12345