Matrix | SoloLearn: Learn to code for FREE!



A=[[1,5],[3,6]] B=[[3,1,-2],[4,0,7]] result=[[0,0,0],[0,0,0]] for i in range(len(A)): for j in range(len(B[0])): for k in range(len(B)): result[i][j] + A[i][k] * B[k][j] for r in result: print(r) this program can not run my computer.please give me a solution and how it does work please explained me

2/28/2018 7:25:44 AM

Kawser Hamid

1 Answer

New Answer


This line is not doing anything: result[i][j] + A[i][k] * B[k][j] If you want to assign a value to result[i][j], you should use the equal sign, like this: result[i][j] = A[i][k] * B[k][j]