Question: this is one program and the output is one t he last page. Please do in Python and show the output which it should semiller

this is one program and the output is one the last page. Please do in Python and show the output which it should semiller to the last page output, and use the main function which provides in the problem.( it really important to use the main function )

this is one program and the output is one the last page.

Please do in Python and show the output which it should semiller

Write list functions for items a to j that carry out the following tasks for a list of integers. a. Swap the first and last elements in the list b. 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 49 16 c. Replace all even elements with 0 (zeroes) d. Replace each element except the first and last by the larger of its two neighbors. e. Remove the middle element if the list length is odd, or the middle two elements if the length is even f. Move all even element to the front, otherwise preserving the order of the elements. g. Return the second largest element in the list. h. Return true if the list is currently sorted in increasing order i. Return true if the list contains two adjacent duplicate elements. j. Return true if the list contains duplicate elements (which need not be adjacent). The main() function to test each of the functions is included here for you. You must use the same function names that is provide for you below. Using other function names will result in a zero for this program. Program to test functions a to j. # Define constant variables. ONE TEN [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] def main): pzint ("The original data for all tunctions is: ", ONE_TEN) #a. Demonstrate swapping the first and last element data list (ONE TEN) swapFirstLast(data) print ("After swapping first and last: ", data) tb. Demonstrate shifting to the right. data = list (ONE-TEN) shiftRight (data) print("After shifting right:", data) #c. Demonstrate replacing even elements with zero. data list (ONE TEN) replaceEven (data) print ("After replacing even elements: ", data) id. Demonstrate replacing values with the larger of their neighbors. data 1ist (ONE TEN) replaceNeighbors (data) print ("After replacing with neighbors: ", data) #e. Demonstrate removing the middle element data 1ist (ONE TEN) removeMiddle (data) print ("After removing the middle element (s): ", data)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!