Skip to content

Commit 47cfbfb

Browse files
committed
38 Matrix transponse
1 parent 40a899a commit 47cfbfb

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

python/tasks/task_38_matrix_transpose.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,14 @@ def matrix_transpose(matrix: list[list[int]]) -> list[list[int]]:
44
"""
55
Vrátí transponovanou matici.
66
"""
7-
7+
if matrix == []:
8+
return ([])
9+
n = len(matrix)
10+
m = len(matrix[0])
11+
new_matrix = []
12+
for i in range(m):
13+
element = []
14+
for j in range(n):
15+
element.append(matrix[j][i])
16+
new_matrix.append(element)
17+
return (new_matrix)

0 commit comments

Comments
 (0)