Write a function called Matrix_mul that takes two 2D list(matrixes) of 3x3named A & B as a parameter and multiplication result of these two matrix
def matrix_mul(A, B):
m = len(A)
n = len(A[0])
if n != len(B):
return
l = len(B[0])
C = []
for i in range(m):
row = []
for j in range(l):
x = 0
for k in range(n):
x += A[i][k] * B[k][j]
row.append(x)
C.append(row)
return C
Comments
Leave a comment