update
This commit is contained in:
20
tools/print_mat.py
Normal file
20
tools/print_mat.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user