Well, from what I understand you were wrong to give the second "combination" since it would actually be: 2x4x8x6x2 = 768
The problem itself, is very confusing, you do not clarify if you should multiply the elements among themselves not following a possible order or just multiply according to the column, do not clarify exactly what the function should result in.
Anyway, I do not know if this is going to help you but good:
def C(matriz):
k=0;
comb_res=[];
for k in range(len(matriz[k])-1): # largo de las columnas ignorando la columna de los 1
sub=[];
elem=[];
i=0;
for i in range(len(matriz)): # largo de las filas
elem.append(matriz[i][k]); #guardo los elementos de la columna k y la fila i
r=1;
l=0;
sub.append(elem); # agrego los elementos
for l in range(len(elem)): # multiplico los elementos guardados
r=elem[l]*r;
sub.append(r); # agrego el resultado
comb_res.append(sub); # agrego los elementos y el resultado de multiplicar
return comb_res;
matrizA=[[2,2,1],[3,4,1],[9,8,1],[6,6,1],[7,2,1]];
prueba=C(matrizA);
i=0;
print(prueba)
And it returns:
[[[2, 3, 9, 6, 7], 2268], [[2, 4, 8, 6, 2], 768]]
Basically it takes all the first elements of the first, second, ..., nth row and saves them. Then, go through the saved items and multiply them. Then, save the saved items and the result of multiplying them in a vector and so on with all the columns. Then, return the created vector.