Files
mt/tools/print_mat.py
Jan Kowalczyk cf15d5501e update
2025-09-10 19:41:00 +02:00

21 lines
346 B
Python

rows = 5
cols = 4
mat = [range(0 + (cols * i), cols + (cols * i), 1) for i in range(rows)]
def print_mat(mat):
for s in mat:
print(*s)
def rotate_mat(mat):
mat = [[mat[row][col] for row in range(rows - 1, -1, -1)] for col in range(cols)]
return mat
print_mat(mat)
mat = rotate_mat(mat)
print("rotated:")
print_mat(mat)