(mtx, rows, cols, func=lambda x: x, prompt="")
| 45 | return (xy % rows, xy // rows) |
| 46 | |
| 47 | def print_matrix(mtx, rows, cols, func=lambda x: x, prompt=""): |
| 48 | print(prompt) |
| 49 | for x in range(rows): |
| 50 | for y in range(cols): |
| 51 | item = mtx[x][y] |
| 52 | item = func(item) |
| 53 | print(item, end=" ") |
| 54 | print() |
| 55 | |
| 56 | # Swizzle<3, 4, 4> |
| 57 | print("Swizzle<3,4,3>") |