Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def square_matrix(matrix1, matrix2):
- size = len(matrix1)
- product = [
- [0,0],
- [0,0]
- ]
- for i in range(size):
- for j in range(size):
- sum = 0
- for k in range(size):
- sum += matrix1[i][k] * matrix2[k][j]
- product[i][j] = sum
- return product
- print(square_matrix(
- [[1,4],
- [7,5]],
- [[6,8],
- [3,2]]
- ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement