Question: Please write the following code in python: Write a function cycle (input_list) that performs an in-place cycling of the elements of a list, moving each
Please write the following code in python:
Write a function cycle (input_list) that performs an "in-place" cycling of the elements of a list, moving each element one position earlier in the list. Here "in place" means the operation should be performed by mutating the original list, and your function should not return anything. Note that you may assume that input_list is non-empty (i.e. contains at least one element) For example: > > > l = [1, 2, 4, 5, 'd'] > > > cycle(l) > > > l [2, 4, 5, 'd', 1] > > > cycle(l) > > > l [4, 5, 'd', 1, 2]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
