daily pastebin goal
34%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def prodMatrix(matrizA, matrizB):
  2.   """Multiplica duas matrizes."""
  3.   sizeLA = len(matrizA)
  4.   sizeCA = len(matrizA[0]) # deve ser igual a sizeLB para ser possível multiplicar as matrizes
  5.   sizeCB = len(matrizB[0])
  6.   matrizR = []
  7.   # Multiplica
  8.   for i in range(sizeLA):
  9.       matrizR.append([])
  10.       for j in range(sizeCB):
  11.           val = 0
  12.           for k in range(sizeCA):
  13.                   val += matrizA[i][k]*matrizB[k][j]
  14.           matrizR[i].append(val)
  15.   return matrizR
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top