Python Spaced Alphabet-Prefix Pyramid (Pattern 68)

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

Output:

Output of the Python Spaced Alphabet-Prefix Pyramid pattern
BEGINNER WALKTHROUGH

How the Spaced Alphabet-Prefix Pyramid works

The right-aligned rows grow from A to AB, ABC, ABCD, and ABCDE.

01

Build the rows

The outer loop sets each row length, and a preceding inner loop prints the alignment spaces.

02

Choose what each row prints

The z counter restarts at 1; chr(z + 64) turns it into a growing alphabet prefix with gaps between letters.

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.