Guest User

Untitled

a guest
Sep 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. def rotate_image(img):
  2. rotated_image = [[] for x in range(len(img))]
  3. for i in range(len(img)):
  4. for j in range(len(img[i])):
  5. rotated_image[len(img) - j - 1].append(img[i][j])
  6. return rotated_image
  7.  
  8. image = [
  9. [1, 1, 5, 9, 9],
  10. [2, 2, 6, 0, 0],
  11. [3, 3, 7, 1, 1],
  12. [4, 4, 8, 2, 2],
  13. [5, 5, 9, 3, 3]
  14. ]
  15.  
  16. rotated_img = rotate_image(image)
  17. for i in rotated_img:
  18. print(i)
  19.  
  20. [9, 0, 1, 2, 3]
  21. [9, 0, 1, 2, 3]
  22. [5, 6, 7, 8, 9]
  23. [1, 2, 3, 4, 5]
  24. [1, 2, 3, 4, 5]
Add Comment
Please, Sign In to add comment