Python Inverted Descending-Number Triangle (Pattern 71)

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

Output:

Output of the Python Inverted Descending-Number Triangle pattern
BEGINNER WALKTHROUGH

How the Inverted Descending-Number Triangle works

The rows read 54321, 4321, 321, 21, and 1, with each shorter line shifted right.

01

Build the rows

The outer counter x decreases from 5 to 1, and its value determines both the padding and sequence start.

02

Choose what each row prints

The inner counter z runs from x down to 1, printing a descending sequence on every row.

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.