Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

ABA Alphabet pyramid

# 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'
Comment

PREVIOUS NEXT
Code Example
Python :: get list values in b/w indexes python 
Python :: myPYmenu 
Python :: how to use the "import random" in-built model in python 
Python :: the most effective search algorithm in python 
Python :: get mismatch element in allclose numpy 
Python :: visualising data with tsne 
Python :: csv/gpd to shapefile python 
Python :: python loop take out element backwardly 
Python :: Creating a bag-of-words in scikit-learn 
Python :: contigent def 
Python :: simulieren mit python 
Python :: how to check if the update_one success in flask 
Python :: python lambda append to list and return it 
Python :: Tree : Top View 
Python :: How to Move and Delete Files in Python 
Python :: Select non-NaN rows and replace column value 
Python :: Delete files in folder by extension 
Python :: run windows command and get output python 
Python :: kivy bind when text changes 
Python :: pydrive download file 
Python :: create a python file and import it as library in other file 
Python :: python input byte array 
Python :: k means image classification 
Python :: import math print(m.cos(10)) 
Python :: python sort by value first then key lexicography 
Python :: how to access cookies in django 
Python :: Applies a function to all elements of this RDD. 
Python :: data exfiltration icmp 
Python :: python pygeoip example 
Python :: vitalik buterin age 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =