Python Inward V Descending-Number Pattern (Pattern 88)

Python Code
n = 5  # size=5
px = 1
py = n * 2 - 1
for x in range(n, 0, -1):
    for y in range(1, n * 2 + 1):
        if (y == px or y == py):
            print(x, end="")
        else:
            print(" ", end="")
    px += 1
    py -= 1
    print()

Output:

Output of the Python Inward V Descending-Number Pattern pattern
BEGINNER WALKTHROUGH

How the Inward V Descending-Number Pattern works

The two inward diagonals are labeled 5, 4, 3, 2, and 1 from top to bottom.

01

Build the rows

The outer loop counts x downward from 5, while the diagonal markers move toward one another.

02

Choose what each row prints

The inner condition prints the current x only at px and py; other columns print spaces.

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.