Python Shrinking Increasing-Number Triangle (Pattern 17)

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

Output:

Output of the Python Shrinking Increasing-Number Triangle pattern
BEGINNER WALKTHROUGH

How the Shrinking Increasing-Number Triangle works

Each row counts up from 1, while the row lengths shrink from five values to one.

01

Build the rows

The outer loop counts down from 6 to 2; using x - 1 as the inner endpoint removes one value each row.

02

Choose what each row prints

The inner counter y always begins at 1, so the rows are prefixes such as 12345, 1234, and 123.

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.