Python Descending Row-Number Square (Pattern 6)

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

Output:

Output of the Python Descending Row-Number Square pattern
BEGINNER WALKTHROUGH

How the Descending Row-Number Square works

The rows show 55555, 44444, 33333, 22222, and 11111.

01

Build the rows

The outer counter x counts down from 5 to 1, choosing the value for each new row.

02

Choose what each row prints

A second five-iteration loop prints x repeatedly, so the row value stays constant across all five columns.

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.