Python Column-Number Square (Pattern 3)

Python Code
for x in range(1, 6):
    for y in range(1, 6):
        print(y, end="")
    print()

Output:

Output of the Python Column-Number Square pattern
BEGINNER WALKTHROUGH

How the Column-Number Square works

Each of the five rows reads 12345, making this a clear example of a fixed-width number grid.

01

Build the rows

The outer loop repeats the row block five times. Its x counter marks the row but does not affect the printed values.

02

Choose what each row prints

The inner y loop restarts at 1 for every row and prints each column number without a separator.

03

Keep the output aligned

The inner print calls use end="" to keep values on the same line. The final empty print() moves to the next row.