112. Python Program to Print Number triangle.
How does this program work?
- This program is used to print Number Triangle using Python.
Here is the code
n=int(input("Enter the number of rows: "));
num = n
a = 1
for i in range(1,n+1):
for j in range(1,num):
print(" ", end=" ")
for j in range(1,a+1):
print(i, end=" ")
if (j<=a/2 ):
i=i+1
else:
i=i-1
a=a+2
num=num-1
print( " ")