In Python, Write a program that rotates the elements of a list so that the element at the first index moves to the second index, the element in the second index moves to the third index, etc., and the element in the last index moves to the first index.
Answers
Answered by
0
Answer:
def rotate(list_a):
return list_a[-1] + list_a[:-1]
Explanation:
Put the last element before the first element. This works but maybe you need a loop based answer.
Similar questions