A=[[1,2,3],[3,4,5]]B=[[3,2,2],[1,1,1]]p = sum(sum(a * b for a, b in zip(*rows)) for rows in zip(A, B))print(p)
Standard input is empty
25
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!