From 12ab1b97111862b9489f060b8a75371981126017 Mon Sep 17 00:00:00 2001 From: Donald Calloway Date: Thu, 2 Oct 2025 09:02:04 -0700 Subject: [PATCH] Converted matrix_transpose.py into a module --- matrix_transpose.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/matrix_transpose.py b/matrix_transpose.py index 093655d..bb1fda3 100644 --- a/matrix_transpose.py +++ b/matrix_transpose.py @@ -13,9 +13,12 @@ Example: ... ] >>> matrix_transpose(matrix) [[1, 4], [2, 5], [3, 6]] + +NOTE: If you import the matrix_transpose module into your project, call it with matrix_transpose.transpose(M). + """ -def matrix_transpose(M) -> List[List]: +def transpose(M) -> List[List]: row = [] T = [] mcols = len(M[0]) @@ -27,15 +30,3 @@ def matrix_transpose(M) -> List[List]: row = [] return T -matrix = [ - [1,2,3,0], - [4,5,6,1], - [7,8,9,2], - [1,2,3,4], - [4,5,6,7] -] - -print(matrix_transpose(matrix)) - -# Output -# [[1, 4, 7, 1, 4], [2, 5, 8, 2, 5], [3, 6, 9, 3, 6], [0, 1, 2, 4, 7]] \ No newline at end of file