Answers for "rotate a matrix 90 degrees clockwise python"

1

rotate matrix 90 degrees clockwise python

#rotate 90 deg clockwise
box=[["a","b"],["c","d"],["e","f"]]

rows = len(box)
cols = len(box[0])

box2 = [[""] * rows for _ in range(cols)]

for x in range(rows):
    for y in range(cols):
        box2[y][rows - x - 1] = box[x][y]
Posted by: Guest on May-16-2021
0

rotate 90 degrees clockwise counter python

new_matrix = [[m[j][i] for j in range(len(m))] for i in range(len(m[0])-1,-1,-1)]
Posted by: Guest on August-17-2020

Code answers related to "rotate a matrix 90 degrees clockwise python"

Python Answers by Framework

Browse Popular Code Answers by Language