Modified matrix_mult to be a module
This commit is contained in:
parent
40f55dbf7d
commit
28e362f63f
@ -22,6 +22,9 @@ Example:
|
||||
... ]
|
||||
>>> multiply(M, N)
|
||||
[[7, 14], [3, 6]]
|
||||
|
||||
NOTE: If you import the matrix_mult module into another project, call it with matrix_mult.multiply(M, N).
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@ -36,18 +39,4 @@ def multiply(M: List[List], N: List[List]) -> List[List]:
|
||||
for k in range(mcols):
|
||||
result[i][j] += M[i][k] * N[k][j]
|
||||
return result
|
||||
|
||||
|
||||
|
||||
M = [
|
||||
[1, 2, 4],
|
||||
[0, 1, 2]
|
||||
]
|
||||
|
||||
N = [
|
||||
[1, 2],
|
||||
[3, 4],
|
||||
[0, 1]
|
||||
]
|
||||
|
||||
print(multiply(M, N))
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user