Question: Use the following template for EVERY function that you write. The docstring below should be placed inside of the function, just after the function signature.

 Use the following template for EVERY function that you write. The
docstring below should be placed inside of the function, just after the

Use the following template for EVERY function that you write. The docstring below should be placed inside of the function, just after the function signature. Purpose: Parameter(s): Return Value: Problem A. (10 points) List Difference Write a function list_difference(numlist1, numlist2) that takes in two lists as parameters. These lists contain numeric values and have the same length. Have the function return a new list that contains the difference between respective items in numlist1 and numlist2, without mutating either of the given lists. You are welcome to add an if __name _ = ' 'main _' block and test cases for this and all functions in this assignment but this is not required. Examples (text in bold is returned): alist =[5,6,7] blist =[2,2,2] list_difference(alist, blist) [3,4,5] alist [5,6,7] blist [2,2,2] list_difference ([0,1,1,2],[3,5,8,13]) Write a function larger_decrement(numlist, n ) that takes two parameters, a list of integers numlist, and an integer n. If the given list contains any number larger than n, then have the function mutate the list by decreasing the largest item in the list by 1 . If the list has two or more elements tied for the largest, only decrease the first occurrence. Then the function should return True. If the given list does not contain any number larger than n, it should return False. Hints: - The autograder will be expecting you to return a boolean value, make sure that you use the specific values True and False Hints: - You are not permitted to use built-in functions like max( or sorted() that trivialize the task of finding the largest element in the list. You are welcome to add an if __name_ == ' _ main__ block and test cases for this and all functions in this assignment but this is not required. Examples (text in bold is returned): alist =[5,20,74,81,0,81,3] > larger_decrement(alist, 50) True alist [5,20,74,80,0,81,3] blist =[1,3,5] larger_decrement(blist, 6)

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!