60 429
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #39170 in Python for Afreen

Question #39170
Write a python 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.
Expert's answer
a = [1,2,3,4,5,6,7,8,9,0]


def cycle_move(l):
l_new = [l[-1]]
for i in l[:-1]:
l_new.append(i)
return l_new

print cycle_move(a)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions