Python Inverted Right-Offset Number Triangle (Pattern 30)

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

Output:

Output of the Python Inverted Right-Offset Number Triangle pattern
BEGINNER WALKTHROUGH

How the Inverted Right-Offset Number Triangle works

The rows contain five 5s, four 4s, down to one 1, with each shorter row shifted right.

01

Build the rows

The outer counter x counts down and supplies the repeated digit; a second loop adds the left padding.

02

Choose what each row prints

The last inner loop prints x copies, so both the digit and the row width decrease together.

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.