Python Right-Aligned Repeated-Letter Triangle (Pattern 27)

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

Output:

Output of the Python Right-Aligned Repeated-Letter Triangle pattern
BEGINNER WALKTHROUGH

How the Right-Aligned Repeated-Letter Triangle works

Each row repeats its own letter, from one A to five Es, with leading spaces forming a right edge.

01

Build the rows

The outer counter x chooses A through E and determines how many copies belong on the row.

02

Choose what each row prints

The first inner loop prints alignment spaces; the next repeats chr(x + 64) for the row length.

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.