Question: Please write the follwing in python. And check with the example to ensure it works. Write a function cycle (input_list) that performs an in-place cycling
Please write the follwing in python. And check with the example to ensure it works.
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
