Advertisement
here2share

# sq_angle_rotate_grid.py

Sep 11th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. # sq_angle_rotate_grid.py
  2.  
  3. matrix =    [   (1,2,3),
  4.             (4,5,6),
  5.             (7,8,9)]
  6.  
  7. rotate_clockwise = zip(*matrix[::-1])
  8. counterclockwise = zip(*matrix)[::-1]
  9. rotate_half_turn = [i[::-1] for i in matrix[::-1]]
  10.  
  11. for array in [matrix,rotate_clockwise,counterclockwise,rotate_half_turn]:
  12.     for row in array:
  13.         print row
  14.     print
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement