contents/matrix: transposition snippet (python) (#634)

This commit is contained in:
Pavel
2026-03-20 00:24:41 -05:00
committed by GitHub
parent 0d08a11efe
commit 7b41c7d9e2

View File

@@ -59,7 +59,7 @@ Many grid-based games can be modeled as a matrix, such as Tic-Tac-Toe, Sudoku, C
Transposing a matrix in Python is simply:
```py
transposed_matrix = zip(*matrix)
transposed_matrix = [[matrix[i][j] for i in range(len(matrix))] for j in range(len(matrix[0]))]
```
## Essential questions