A = [[3, 7, 3],
          [4, 8, 1],
          [2, 7, 5]]
      B = [[2, 8, 1, 2],
          [7, 9, 2, 0],
          [3, 6, 7, 1]]
      result = [[0, 0, 0, 0],
              [0, 0, 0, 0],
              [0, 0, 0, 0]]
      # iterating by row of A
      for i in range(len(A)):
          # iterating by column by B
          for j in range(len(B[0])):
              # iterating by rows of B
              for k in range(len(B)):
                  result[i][j] += A[i][k] * B[k][j]
      for r in result:
          print(r)
      
      Python language logo

      Product of Matrices

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.