Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_rotate(x,y):
- item = list()
- rotate_x = list()
- count = 0
- while count < len(x):
- for i in x:
- item.append(i[count])
- rotate_x.append(item)
- item = list()
- count += 1
- return rotate_x == y
- #Main Program
- x = [[1,2,3],[4,5,6],[7,8,9]]
- y = [[1,4,7],[2,5,8],[3,6,9]]
- z = [[3,6,9],[2,5,8],[1,4,7]]
- print(is_rotate(x,y))
- print(is_rotate(y,x))
- print(is_rotate(x,z))
Advertisement
Add Comment
Please, Sign In to add comment