PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Number = int(input())
#Create ones Matrix
arr = [x[:] for x in [[1] * Number] * Number]
#Fill values where applicable
for i in range(2,Number-1):
for j in range(1,i):
arr[i][j]=arr[i-1][j]+arr[i-1][j-1]+arr[i][j-1]
#Print Triangle
for i in range(Number):
for j in range(i+1):
print(arr[i][j], end=' '*(1+len(str(arr[Number-2][j]))-len(str(arr[i][j])) ) )#With Spaces as per the biggest numbers which are in the second last row
print('')
#https://www.sololearn.com/Discuss/628136/daily-challenge-write-a-code-that-gets-as-input-a-positive-number-n-1-and-prints-n-rows-from-3-sum
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run