You can only multiply two matrices if their dimensions are compatible , which means the number of columns in the first matrix is the same as the number of rows in the second matrix.
Code:
X=[[12,9,3],
[4,5,6],
[7,8,3]]
Y=[[6,8,1,3],
[5,7,3,4],
[0,6,9,1]]
result=[[0,0,0,0],
[0,0,0,0],
[0,0,0,0]]
for i in range(len(X)):
for j in range(len(Y[0])):
for k in range(len(Y)):
result[i][j]+=X[i][k]*Y[k][j]
for r in result:
print(r)
Nesta página do site você pode assistir ao vídeo on-line 55. Matrix Multiplication using Nested loops with Code || Matrix as Nested List Programming Tutorial duração online em boa qualidade , que foi baixado pelo usuário Ram Case 25 Agosto 2022, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 512 vezes e gostou 2 espectadores. Boa visualização!