Hello, I'm doing an algorithm in python that makes the product between two arrays, but I'm having trouble displaying the resulting array
matriz = []
linha = []
linha2= []
matriz_result = []
result = 0
lista = []
nlin,ncol= map(int,input().split())
for i in range(0,nlin):
valor = (input().split())
valor = list(map(int,valor))
linha.append(valor)
matriz.append(linha)
matriz2 = []
nlin2,ncol2 = map(int,input().split())
for i in range(0,nlin2):
valor = (input().split())
valor = list(map(int,valor))
linha2.append(valor)
matriz2.append(linha2)
for i in range(nlin):
if ncol!=nlin2:
print("ERRO")
for j in range(ncol):
for h in range(0,1):
for k in range(ncol):
result += matriz[i][i][k]*matriz2[k][k][i]
matriz_result.append(result)
print(matriz_result)
I have to put the array entries on the same line, so for some reason an array element is given by three parameters.
Does anyone know what I need to change in the code?