Write a Python program to print downward triangle mirrored alphabets pattern using for loop.
rows = int(input("Enter Downward Triangle Mirrored Alphabets Rows = ")) print("====Downward Triangle of Mirrored Alphabets Pattern====") alphabet = 65 for i in range(rows): for j in range(i, rows): print('%c' %(alphabet + j), end = ' ') for k in range(rows - 2, i - 1, -1): print('%c' %(alphabet + k), end = ' ') print()
This Python example prints the downward triangle pattern of mirrored alphabets using a while loop.
rows = int(input("Enter Downward Triangle Mirrored Alphabets Rows = ")) print("====Downward Triangle of Mirrored Alphabets Pattern====") alphabet = 65 i = 0 while(i < rows): j = i while(j < rows): print('%c' %(alphabet + j), end = ' ') j = j + 1 k = rows - 2 while(k >= i): print('%c' %(alphabet + k), end = ' ') k = k - 1 print() i = i + 1
Enter Downward Triangle Mirrored Alphabets Rows = 14
====Downward Triangle of Mirrored Alphabets Pattern====
A B C D E F G H I J K L M N M L K J I H G F E D C B A
B C D E F G H I J K L M N M L K J I H G F E D C B
C D E F G H I J K L M N M L K J I H G F E D C
D E F G H I J K L M N M L K J I H G F E D
E F G H I J K L M N M L K J I H G F E
F G H I J K L M N M L K J I H G F
G H I J K L M N M L K J I H G
H I J K L M N M L K J I H
I J K L M N M L K J I
J K L M N M L K J
K L M N M L K
L M N M L
M N M
N