Question: PYTHON Question 2318 pts Write list functions that carry out the following tasks for a list of integers. Write a test program functions.py. 1. swapFirstLast
PYTHON Question 2318 pts Write list functions that carry out the following tasks for a list of integers. Write a test program functions.py. 1. swapFirstLast function: Swap the first and last elements in the list. 2. replaceEven function: Replace all even elements with 0. 3. islncreasing function: Return true if the list is currently sorted in increasing order 4. hasDuplicate function: Return true if the list contains duplicate elements (which need not be adjacent). Sample run: The original data for all functions is: [1, 2, 3, 4, 5, 6, 7, 8, 9, 1e] After swapping first and last: [10, 2, 3, 4, 5, 6, 7, 8, 9, 1] After replacing even elements: [1, e, 3, e, 5, e, 7, , 9, 0] The list is in increasing order: True The list has duplicates: False Question 225 pts Write a function sumWithoutSmallest that computes the sum of a list of values, except for the smallest one, in a single loop. In the loop, update the sum and the smallest value. After the loop, subtract the smallest value from the sum and return the difference
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
