Logic Building
# Take n
n = int(input("Enter number of rows: "))
# Print pattern
for i in range(1, n + 1):
for j in range(1, i + 1):
print(j, end="")
print()Output
Enter number of rows: 4 1 12 123 1234
Print numbers from 1 to i in each row.
Key Concepts:
- Outer loop: rows
- Inner loop: print j from 1 to i
- Sequential numbers