There's a question in my assignment that involves arrays and for loops.
The question asks you to find the value of int(m[3,4])
.
import numpy as np
m = np.zeros((20,20))
for i in range(1,20):
for j in range(1,20):
m[i,j] = m[i-1,j]+m[i,j-1]+ 1
print(int(m[3,4]))
I've tried writing out all the values of m[i, j]
for i
and j
in range 0 to 5 to find m[3,4]
, but I'm wondering if there's a shorter way of doing things?
The expected answer is 34.