Python Program to Print Triangle Alphabets Pattern

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

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

print("====Print Triangle Alphabets Pattern ====")

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

This Python example displays the alphabets in a triangle pattern using a while loop.

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

print("====Print Triangle Alphabets Pattern ====")

i = 0

while(i < rows):
    alphabet = 65
    j = rows
    while(j > i):
        print(end = ' ')
        j = j - 1
    k = 0
    while(k <= i):
        print('%c' %(alphabet + k), end = ' ')
        k = k + 1
    print()
    i = i + 1
Enter Triangle Alphabets Pattern Rows = 10
====Print Triangle Alphabets Pattern ====
          A 
         A B 
        A B C 
       A B C D 
      A B C D E 
     A B C D E F 
    A B C D E F G 
   A B C D E F G H 
  A B C D E F G H I 
 A B C D E F G H I J