Python Inverted Repeated-Letter Pyramid (Pattern 51)

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(chr(x + 64), end="")
    decr -= 2
    print()

Output:

Output of the Python Inverted Repeated-Letter Pyramid pattern
BEGINNER WALKTHROUGH

How the Inverted Repeated-Letter Pyramid works

The centered rows repeat D seven times, C five times, B three times, and A once.

01

Build the rows

The outer counter x moves backward through D to A while the indentation increases.

02

Choose what each row prints

The decr counter controls how many copies appear; chr(x + 64) converts the row number to its letter.

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.