Python Program to Print Mirrored Right Triangle Alphabets Pattern

Write a Python program to print mirrored right triangle alphabets pattern using for loop.

rows = int(input("Enter Mirrored Right Triangle Alphabets Pat Rows = "))

print("====The Mirrored Right Triangle Alphabets Pattern====")
alphabet = 65

for i in range(0, rows + 1):
    for j in range(1, rows - i + 1):
        print(end = ' ')
    for k in range(i + 1):
        print('%c' %(alphabet + i), end = '')
    print()
Python Program to Print Mirrored Right Triangle Alphabets Pattern

This Python example prints the mirrored right angled triangle of alphabets pattern using a while loop.

rows = int(input("Enter Mirrored Right Triangle Alphabets Pat Rows = "))

print("====The Mirrored Right Triangle Alphabets Pattern====")
alphabet = 65
i = 0

while(i <= rows):
    j = 1
    while(j <= rows - i):
        print(end = ' ')
        j = j + 1
    k = 0
    while(k <= i):
        print('%c' %(alphabet + i), end = '')
        k = k + 1
    print()
    i = i + 1
Enter Mirrored Right Triangle Alphabets Pat Rows = 13
====The Mirrored Right Triangle Alphabets Pattern====
             A
            BB
           CCC
          DDDD
         EEEEE
        FFFFFF
       GGGGGGG
      HHHHHHHH
     IIIIIIIII
    JJJJJJJJJJ
   KKKKKKKKKKK
  LLLLLLLLLLLL
 MMMMMMMMMMMMM
NNNNNNNNNNNNNN

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.