MacSG

LabComPro-Mid_4

Mar 29th, 2015
293
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. def is_rotate(x,y):
  2.  
  3.     item = list()
  4.     rotate_x = list()
  5.     count = 0
  6.    
  7.     while count < len(x):
  8.         for i in x:
  9.             item.append(i[count])
  10.         rotate_x.append(item)
  11.         item = list()
  12.         count += 1
  13.     return rotate_x == y
  14.  
  15. #Main Program
  16. x = [[1,2,3],[4,5,6],[7,8,9]]
  17. y = [[1,4,7],[2,5,8],[3,6,9]]
  18. z = [[3,6,9],[2,5,8],[1,4,7]]
  19. print(is_rotate(x,y))
  20. print(is_rotate(y,x))
  21. print(is_rotate(x,z))
Advertisement
Add Comment
Please, Sign In to add comment