Skip to content

Commit

Permalink
0-rotate_2d_matrix.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambesawi committed Nov 16, 2023
1 parent 6b23595 commit 2df0b8f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 0x07-rotate_2d_matrix/0-rotate_2d_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/python3
"""
2D matrix rotation module.
"""


def rotate_2d_matrix(matrix):
"""
Rotates a n by n 2D matrix in place.
"""
i = 0
for v in list(zip(*matrix)):
matrix[i][:] = v[::-1]
i += 1

0 comments on commit 2df0b8f

Please sign in to comment.