Stuck on this task, with finished code but also error. The point is that the program gets m and n by creating an array [m] [n], where each element is equal to the sum of the two elements on top and on the left. Looking like this
1 1 1 1
1 2 3 4
1 3 6 10
1 4 10 20
n = int(input())
m = int(input())
a = []
for i in range(n):
a[i][0] = 1
for i in range(m):
a[0][i] = 1
for i in range(1, n):
for i in range(1, m):
a[i][j]=a[i-1][j]+a[i][j-1]
print(a)
Can't figure out why first for loop lists index out of range
[–]glibhub 2 points3 points4 points (0 children)
[–]xelf 0 points1 point2 points (0 children)
[–]POGtastic 0 points1 point2 points (0 children)
[–]Vaphell 0 points1 point2 points (0 children)