This Python program reads the number of rows from the user and generates a structured output based on that count.
In this example, the output is a numeric triangle, but you can customize it to display stars, letters, or any other pattern.
rows = int(input("Enter number of rows: "))
for i in range(1, rows + 1):
for j in range(1, i + 1):
print(j, end=" ")
print()
1
1 2
1 2 3
1 2 3 4
- The user inputs the number of rows
- A nested loop prints numbers from 1 up to the current row index
- Each row is printed on a new line
- You can easily modify this to generate other patterns like Pascal’s triangle, binary sequences, or ASCII art