This question is a bit tricky for me.The input is a list of lists like:
matmult([[1,2],[3,4]],[[1,0],[0,1]])
Output:
matmult([[1,2],[3,4]],[[1,0],[0,1]])
[[1,2],[3,4]]
matmult([[1,2,3],[4,5,6]],[[1,4],[2,5],[3,6]])
[[14, 32], [32, 77]]
Here's my broken code for the same:
def matmult(m1,m2):
x=0
y=0
a=0
for value in range(0,len(m1)):
for other in range(0,len(m2)):
a=m1[value]*other[value]+other[value]*m2[value]
return(a)
where matmult
is the name of my function.
Do help me.