Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. def manip_matrice(A, B, i, j):
  2. m_A = len(A[0])
  3. m_B = len(B[0])
  4. count = True
  5.  
  6. for c in range(len(A)):
  7. n_A = len(A[c])
  8.  
  9. if m_A != n_A :
  10. count = False
  11.  
  12. for d in range(len(B)):
  13.  
  14. n_B = len(B[d])
  15.  
  16. if m_B != n_B :
  17. count = False
  18.  
  19. if count == True:
  20. if len(A[0]) != len(B):
  21. return "Ces matrices ne se multiplient pas"
  22. else:
  23. matrice = np.zeros(( len(A), len(B[0]) ))
  24. for a in range(len(A)):
  25. for b in range(len(B[0])):
  26. for k in range(len(A[0])):
  27. matrice[a][b] += A[a][k] * B[k][b];
  28. print(matrice)
  29. return matrice[i][j];
  30. else:
  31. return "Ces matrices ne se multiplient pas"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement