Aba Alphabet Pyramide

# Python 3 program
# to print Alphabet Pattern-12
# as shown below
'''
    A
   ABA
  ABCBA
 ABCDCBA
ABCDEDCBA
  
'''

# Ascii code of A=65,E=69,F=70
# Print certain number of spaces before alphabets


rows=5
ch = 'A'
# outer loop for ith rows
for i in range (1,rows+1):
    for space in range(rows-i):
        print(' ',end='')

    # this loop will print    
    #     A
    #    AB
    #   ABC
    #  ABCD
    # ABCDE
    for j in range(1, i+1):
        print(ch,end="")
        ch=ord(ch)+1
        ch = chr(ch)
    ch=ord(ch)-1
    ch = chr(ch)
    # this loop will print remaining pattern
    # after center line
    #     
    #    A
    #    BA
    #    CBA
    #    DCBA

    for k in range(1, i):
        ch=ord(ch)-1
        ch = chr(ch)
        print(ch,end="")
    
        
    print()
    ch='A'
samuel karanja