Reverse Repeated Alphabet Pattern (EEEEE to A) in Python

Beginner
⏱️ 6 min read
📚 Updated: Aug 2025
🎯 2 Code Examples
n(n+1)/2 letters total

What You'll Learn

This program prints a reverse repeated-letter pattern where the letter decreases each row, and the repeat count decreases too.

With rows = 5, the top letter is E and the output becomes EEEEE, DDDD, CCC, BB, A.

⭐ Pattern Output

When you run the program with rows = 5:

Output
EEEEE
DDDD
CCC
BB
A
1

Complete Python Program (Nested Loops)

This version prints each character using a nested loop.

Python
rows = 5
rows = max(1, min(rows, 26))

base = ord('A')
top = base + rows - 1

for row in range(rows, 0, -1):
    ch = chr(base + (row - 1))
    for _ in range(row):
        print(ch, end="")
    print()

🧠 How It Works

1

Count row down from rows

for row in range(rows, 0, -1) gives row lengths 5, 4, 3, 2, 1 when rows = 5. The letter is chr(base + (row - 1)), so the top row is five Es.

Outer
2

Print row copies of one letter

The inner loop repeats the current letter exactly row times. As row shrinks, both width and letter code decrease.

Inner
3

Row break

After the inner loop, print() moves to the next line so each pattern row is separate.

print
=

Shrinking repeated rows

Again you print n(n+1)/2 characters total — O(n²) time, O(1) extra space.

2

Variation — String Repetition (Concise)

Same pattern using ch * count.

Python
rows = 5
rows = max(1, min(rows, 26))

base = ord('A')

for row in range(rows, 0, -1):
    ch = chr(base + (row - 1))
    print(ch * row)

💡 Tips for Enhancement

Try These

  • Print lowercase using base = ord('a')
  • Start from a fixed letter like Z by setting top manually
  • Add spaces between characters for readability

Avoid

  • Hardcoding ASCII values like 69 and 64
  • Letting rows exceed 26 without wrap-around logic

Key Takeaways

1

For each row, compute the letter with chr(base + (row - 1)).

2

Use range(rows, 0, -1) to count rows downward.

3

Total printed letters are \(n(n+1)/2\), so runtime is O(n²).

❓ Frequently Asked Questions

For rows = 5, the top letter is 'A' + (rows - 1), which is E. The first row repeats the current letter rows times.
It prints 1+2+…+n = n(n+1)/2 letters in total.
Use string repetition: print(ch * count).

Next: Python Alphabet Pattern 12

Continue to Program 12 for another repeated-letter variation.

Program 12 →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful