Python Program to Print Pyramid Alphabets Pattern

Write a Python program to print pyramid alphabets pattern using for loop.

rows = int(input("Enter Alphabets Pyramid Pattern Rows = "))

print("====The Pyramid of Alphabets Pattern====")
alphabet = 64

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

This Python example prints the pyramid pattern of alphabets using a while loop.

rows = int(input("Enter Alphabets Pyramid Pattern Rows = "))

print("====The Pyramid of Alphabets Pattern====")
alphabet = 64
i = 1

while(i <= rows):
    j = 1
    while(j <= rows - i):
        print(end = ' ')
        j = j + 1
    k = i
    while(k > 0):
        print('%c' %(alphabet + k), end = '')
        k = k - 1
    l = 2
    while(l <= i):
        print('%c' %(alphabet + l), end = '')
        l = l + 1
    print()
    i = i + 1
Enter Alphabets Pyramid Pattern Rows = 12
====The Pyramid of Alphabets Pattern====
           A
          BAB
         CBABC
        DCBABCD
       EDCBABCDE
      FEDCBABCDEF
     GFEDCBABCDEFG
    HGFEDCBABCDEFGH
   IHGFEDCBABCDEFGHI
  JIHGFEDCBABCDEFGHIJ
 KJIHGFEDCBABCDEFGHIJK
LKJIHGFEDCBABCDEFGHIJKL