Python Program to Print Triangle of Same Alphabets Pattern

Write a Python program to print triangle of same alphabets pattern in each row using for loop.

rows = int(input("Enter Triangle of Same Row Alphabets Rows = "))

print("====The Triangle of Same Alphabets in each Row Pattern====")
alphabet = 65

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

This Python pattern example prints the triangle of the same alphabet in every single row using a while loop.

rows = int(input("Enter Triangle of Same Row Alphabets Rows = "))

print("====The Triangle of Same Alphabets in each Row Pattern====")
alphabet = 65
i = 0

while(i < rows):
    j = rows - 1
    while(j > i):
        print(end = ' ')
        j = j - 1
    k = 0
    while(k <= i):
        print('%c' %(alphabet + i), end = ' ')
        k = k + 1
    print()
    i = i + 1
Enter Triangle of Same Row Alphabets Rows = 12
====The Triangle of Same Alphabets in each Row Pattern====
           A 
          B B 
         C C C 
        D D D D 
       E E E E E 
      F F F F F F 
     G G G G G G G 
    H H H H H H H H 
   I I I I I I I I I 
  J J J J J J J J J J 
 K K K K K K K K K K K 
L L L L L L L L L L L L 

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.