Question: in python Write a function larger_decrement(numlist, n ) that takes two parameters, a list of integers numlist, and an integer n. If the given list

in python Write a function larger_decrement(numlist, n ) that takes two parameters,in python

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 Constraints: - 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) False >> blist [1,3,5]

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!