Question: python 1. Write list functions that carry out the following tasks for a list of integers. Your functions should not return a new list, instead
1. Write list functions that carry out the following tasks for a list of integers. Your functions should not return a new list, instead it should act on the list given to it. (a) Shift all elements by one to the right and move the last element into the first position. For example, (1,4,9,16,25] would be transformed into [25,1,4,9,16]. Name the function shift(values). (b) Replace each element except the first and last by the larger of its two neighbours. For example, (1,4,9,16,25] would be transformed into (1,9,16,25,25). Name the function larger (values). () Move all even elements to the front, otherwise preserving the order of the elements. For example, (1,4,9,16,25) would be transformed into [4,16,1,9,25). Name the function evensFirst (values)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
