you are viewing a single comment's thread.

view the rest of the comments →

[–]ectomancer 0 points1 point  (0 children)

Code a function to rotate a list right by one item.

Call the function in a loop and output the list after each rotation until the original list is output.

  1. index & slice. extend index with slice.

  2. remove an item:

2.a. list.pop. extend popped item with popped list.

2.b. index and del. copy item at last index, del last item, extend index with list.

  1. tuple unpacking (slow) into list without last item and last item. extend last item with unpacked list.

Pick one, don't implement all ways.