In this program, we will print the following pattern using Python.
Steps to solve the program
# Part1 : First will print triangle of numbers in increasing order.
num1 = 65
for i in range(5):
for j in range(i+1):
print(chr(num1), end=" ")
num1 += 1
print()
# Part2 : Second will print triangle of number is decreasing order.
for k in range(5, 0, -1):
for l in range(k-1):
num1 += 1
print(chr(num1), end=" ")
print()
Output :
A
B C
D E F
G H I J
K L M N O
Q R S T
U V W
X Y
Z