Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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]
 
PREVIOUS NEXT
Tagged: #rotate #matrix #degrees #clockwise #python
ADD COMMENT
Topic
Name
3+9 =