title: How to multiply two lists and store its sum in a 2D array?
body: <p>I want to multiply two 2D array in such a way that first array's row will be multiplied with the column of the second one. </p>
  
  <p>So I transposed the second array so that its column changed to its transposedone's row. Then I extracted two rows from the 2D arrays one by one and treated them as two simple list, multiplied them and stored them in another list. </p>
  
  <p>I want to store them as 00 (row-column) element of the resultant 2D array. How can I do it?</p>
  
  <pre><code>NO_OF_ROWS_A=int(input("Enter the no. of rows in A: "))
  NO_OF_COLUMNS_A=int(input("Enter the no. of columns in A: "))
  NO_OF_ROWS_B=int(input("Enter the no. of rows in B : "))
  NO_OF_COLUMNS_B=int(input("Enter the no. of columns in B: "))
  
  mat_A=[[] for i in range(NO_OF_ROWS_A)]
  for i in range(NO_OF_ROWS_A):
      for j in range (NO_OF_COLUMNS_A):
          print("Enter",i,j,"element for mat A: ")
          a=int(input())
          mat_A[i].append(a)
  
  mat_B=[[] for i in range(NO_OF_ROWS_B)]
  for i in range(NO_OF_ROWS_B):
      for j in range (NO_OF_COLUMNS_B):
          print("Enter",i,j,"element for mat B: ")
          b=int(input())
          mat_B[i].append(b)
  
  import itertools
  mat_B_trans = list(itertools.zip_longest(*mat_B))#transposes B to change its col into row
  
  sum_list_x=0
  
  mat_C=[[] for i in range(NO_OF_ROWS_A)]
  for i in range(NO_OF_ROWS_A):
      for j in range(NO_OF_COLUMNS_B):
          for i in range(NO_OF_ROWS_A):#extracts row of A
              list_row_a=mat_A[i]
          for j in range(NO_OF_COLUMNS_B):#extracts row of trans_B which is col of B
              list_column_b=mat_B_trans[i]
          list_temp_multiple=[a*b for a,b in zip(list_row_a, list_column_b)]#list of multiples of same indices of A &amp; B
          sum_list=sum(list_temp_multiple)#sum of prev list elemets
          sum_list_x=sum_list_x + sum_list
  
          c = sum_list_x
          mat_C[i].append(c)
  print(mat_C)
  </code></pre>