This Python program reads the number of rows from the user.
It then prints a pyramid of numbers, where each row contains repeated values equal to the row number.
The spacing ensures the pyramid shape is visually aligned.
rows = int(input("Enter number of rows: "))
for i in range(1, rows + 1):
print(" " * (rows - i), end="") # spacing for pyramid alignment
print((str(i) + " ") * i)
1
2 2
3 3 3
4 4 4 4
- The outer loop runs from 1 to rows
- Each row begins with spaces to align the pyramid
- Then the row number i is printed i times with spacing
- The result is a clean, centered pyramid of repeating numbers