Python Inverted Centered Number Sequence (Pattern 50)

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

Output:

Output of the Python Inverted Centered Number Sequence pattern
BEGINNER WALKTHROUGH

How the Inverted Centered Number Sequence works

The rows count from 1 up to 7, then 5, 3, and 1, forming a shrinking centered sequence.

01

Build the rows

The outer loop creates four rows and adds increasing left padding as the pattern narrows.

02

Choose what each row prints

The inner z counter starts at 1 and stops at decr; decr decreases by two after each 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.