Python Program to Print 1-12-123-1234 Pattern up to n lines


This program prints 1-12-123-1234 pattern up to n lines in Python programming language.


Python Source Code: Generate 1-12-123 Pattern


# 1-12-123-1234 Pattern up to n lines

n = int(input("Enter number of rows: "))

for i in range(1,n+1):
    for j in range(1, i+1):
        print(j, end="")
    print()

Output

Enter number of rows: 6

1
12
123
1234
12345
123456