Python Print Alphabet Patterns 11 Programs

By | March 27, 2020

Topic: Python Print Alphabet Patterns Programs

Alphabets patterns and shapes printing programs for Python Novice Programmers

Alphabets patterns and shapes printing programs use nested for loops normally. Print alphabets Pattern programs are very importnat for program logic building in novice Python programmers. These programs improves thinking power of the beginner programmers to solve a given problem. They will select proper statements and parameters to get the required output for the given alphabet pattern programming examples.

Basic Knowledge Requirements for Printing Alphabet Patterns Programs in Python

  1. Here we will use the ord(‘A’) function that will give 65, Ascii code of A, similarly, it will give 66 for B, and 67 for C and So on.
  2. Similarly using chr(65) function will give the character ‘A’. You may guess easily, it will give the character B for the number (ascii code) 66, and C for 67 and so on. It takes an Ascii code and returns a corresponding character.
  3. ord(‘a) returns 97
  4. Nested for loops may be used in alphabet patterns and shapes printing programs. The use of nested for loops is good for beginner programmers to improve programming logic and problem solving skills in computer progrmming field.
  5. Outer for loop is used for rows
  6. Inner for loop is used for columns
  7. There is a need for a third for loop to include some spaces according to the program requirement.
  8. Looping Statements in Python
  9. Python range Function in for loop
  10. Python for Statement Syntax & Examples

Here are the sample code for 11 popular Python Print Alphabet Patterns Programs

"<yoastmark

Print Alphabet Pattern – 1

In this Python ABC – alphabetic pattern program, we use the two nested for loops. The outer loop works in the range(65,70) that is for loop control variable;s value 65, 66, 67, 68 and 69. Note that we have to print only 5 lines of alphabets. Why do we start the outer for loop from 65? because 65 is the ascii code of the letter ‘A’ and ‘E’ has the ascii code of 69.

The inner for loop is used to print the alphabets in each row. For example, in the first row it will print the value of chr(j) where j is 65, hence the letter ‘A’ is printed.

We will use chr(asciicode) function to display the character with the given ascii code value.

# Python 3 program
# to print Alphabet Pattern - 1
# as shown below
'''
A
AB
ABC
ABCD
ABCDE

'''

# Note that Ascii codes of A =65
# and Ascii code of E=69,
# F=70

# outer loop for ith rows
for i in range (65,70):
    # inner loop for jth columns
    for j in range(65,i+1):
        print(chr(j),end="")
        
    print()

different approach to print Alphabetic pattern – 1

rows=5
for i in range(1, rows+1):
	# since ascii of A is 65
    for j in range(65, 65+i):
        a = chr(j)  # chr(65) -> A
        print(a, end=' ')
    print()

# Python  program  to print Alphabet Pattern-2

This alphabet pattern Python program will also use the two for loops. Here the outer for loop runs from 70 to 66, that is fpr five times. This is because we have to print 5 rows of alphabets.

The inner loop will run for 65 to 69, therefore, it will print A because of chr(65), B for chr(66) and so on. Hence ABCDE is printed in the first line. In the second row, the inner loop will execute to print ABCD for loop control variable j’s value from 65 to 68, and so on.

# Python 3 program
# to print Alphabet Pattern-2
# as shown below
'''
ABCDE
ABCD
ABC
AB
A

'''
# Note that Ascii codes of A =65
# and Ascii code of E=69,
# F=70

# outer loop for ith rows
for i in range (70,65,-1):
    # inner loop for jth columns
    for j in range(65,i):
        print(chr(j),end="")
        
    print()

 Python  program  to print Alphabet Pattern-3

The Program number 3 will show the following alphabets pattern using the nested for loops. The inner for loop will print EDCBA for the first row. It uses chr(69) for printing E and to chr(65) for printing the letter ‘A’. In the second line, the loop will run for j=69 to 66, printing EDCB and so on.

# Python 3 program
# to print Alphabet Pattern-3
# as shown below
'''

EDCBA
EDCB
EDC
ED
E


'''

# Note that Ascii codes of A =65
# and Ascii code of E=69,
# F=70

# outer loop for ith rows
for i in range (65,70):
    # inner loop for jth columns
    for j in range(69,i-1,-1):
        print(chr(j),end="")
        
    print()

For Novice Python  Programmer’s Print Alphabet Pattern-4

The Alphabetic Pattern 4 program in Python programming language uses the nested for loops and the inner for loop print chr(i). Hence in the first row only ‘A’ is printed. In the second row chr(i) will print B to times, and so on.

# Python 3 program
# to print Alphabet Pattern-4
# as shown below
'''

A
BB
CCC
DDDD
EEEEE


'''

# Note that Ascii codes of A 

=65
# and Ascii code of E=69,
# F=70

# outer loop for ith rows
for i in range (65,70):
    # inner loop for jth columns
    for j in range(65,i+1):
        print(chr(i),end="")
        
    print()

  Print Alphabet Pattern-5 in Python    

# Python 3 program
# to print Alphabet Pattern-5
# as shown below
'''

AAAAA
BBBBB
CCCCC
DDDDD
EEEEE


'''

# Note that Ascii codes of A =65
# and Ascii code of E=69,
# F=70

# outer loop for ith rows
for i in range (65,70):
    # inner loop for jth columns
    for j in range(65,70):
        print(chr(i),end="")
        
    print()

Programming in Python Print Alphabet Pattern-6

# Python 3 program
# to print Alphabet Pattern-6
# as shown below
'''
M
MN
MNO
MNOP
MNOPQ

'''

# ord('M') rreturns 77
# 

# outer loop for ith 

rows
for i in range (ord('M'),ord('Q')+1):
    # inner loop for jth columns
    for j in range(ord('M'),i+1):
        print(chr(j),end="")
        
    print()

Solution: Print Alphabet Pattern-7

# Python 3 program
# to print Alphabet Pattern-7
# as shown below
'''

A
BC
CDE
DEFG
EFGHI


'''

# Ascii code of A=65,E=69,F=70
# 

# outer loop for ith rows
for i in 

range (65,70):
    alpha = i
    # inner loop for jth columns
    for j in range(65,i+1):
        print(chr(alpha),end="")
        alpha+=1
        
    print()

Print Alphabet Pattern-8 (Python 3)

# Python 3 program
# to print Alphabet Pattern-8
# as shown below
'''
A
AB
ABC
ABCD
ABCDE

'''

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

spaces=5
# outer loop for ith rows
for i in range (65,70):
    for k in range(spaces):
        print(' ',end='')
    # inner loop for jth columns
    for j in range(65,i+1):
        print(chr(j),end="")

    spaces-=1            
    print()

Python Program Print Alphabet Pattern-9

# Python 3 program
# to print Alphabet Pattern-9
# as shown below
'''
      ABCDE
       ABCD
        ABC
         AB
          A
'''

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

spaces=5
# outer loop for ith rows
for i in range (70,65,-1):
    for k in range(spaces):
        print(' ',end='')
    # inner loop for jth columns
    for j in range(65,i):
        print(chr(j),end="")

    spaces+=1            
    print()

Program Print Alphabet Pattern-10

# Python 3 program
# to print Alphabet Pattern-10
# as shown 
below
'''
        B 
      B B B 
    B B B B B 
  B B B B B B B 
B B B B B B B B B
  
'''
rows=5
# outer loop for ith 

rows
for i in range (1,rows+1):
    for space in range(rows-i): 
       print(' ',end=' ')
    # inner loop for jth columns
    for j in range(1, 2*i):
        print('B ',end="")

    print()

Python Print Alphabet Pattern-11

# Python 3 program
# to print Alphabet Pattern-11
# as shown below
'''
B B B B B B B B B 
  B B B B B B B 
    B B B B B 
      B B B 
        B 
  
'''

rows=5
# outer loop for ith 

rows
for i in range (rows,0,-1):
    for space in range(rows-i):
        print(' ',end=' ')
    # inner loop for jth columns
    for j in range(1, 2*i):
        print('B ',end="")

    print()

Alphabet Pattern Program No. 12

# Python program
# to print Alphabet Pattern-12
# as shown below

    A
   ABA
  ABCBA
 ABCDCBA
ABCDEDCBA
  

Print ABA Alphabet Pattern Pyramid Python Program

Loading

Leave a Reply

Your email address will not be published. Required fields are marked *