Rotate and Transpose a Matrix

easy
Unit 5 · Lists & Context Managers0/3 to milestone

Implement matrix operations on lists of lists, without NumPy:

  • transpose(m): rows become columns. Works for non-square matrices.
  • rotate_clockwise(m): rotate 90° clockwise. A 2×3 matrix becomes 3×2.
  • rotate_in_place(m): rotate a square matrix 90° clockwise by modifying it in place (transpose, then reverse each row), returning None.

Don't modify the input in transpose or rotate_clockwise.

#lists#matrices2 visible + 2 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Rotate and Transpose a Matrix · TechGradify