Archive

Posts Tagged ‘matrix’

rotate a matrix

August 22, 2014 1 comment

Rotate clockwise:

rotated = zip(*original[::-1])

Rotate counterclockwise:

rotated_ccw = zip(*original)[::-1]

I found this trick in this thread.