A=[[1,2,3],[4,5,6]]
B=[[1,2,3],[4,5,6],[7,8,9]]
result = [] # final result
for i in range(len(A)):
row = [] # the new row in new matrix
for j in range(len(B)):
product = 0 # the new element in the new row
for v in range(len(A[i])):
product += A[i][v] * B[v][j]
row.append(product) # append sum of product into the new row
result.append(row) # append the new row into the final result
print(result)
(или)
A=[[1,2,3],[4,5,6]]
B=[[1,2,3],[4,5,6],[7,8,9]]
result = [[sum(a * b for a, b in zip(A_row, B_col)) for B_col in zip(*B)] for A_row in A]
print(result)
Надеюсь, это поможет.