Modified matrix_mult to be a module

This commit is contained in:
Donald Calloway 2025-10-02 08:53:18 -07:00
parent 40f55dbf7d
commit 28e362f63f

View File

@ -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))