Question: Need to come up with a coding in python. The blue highlighted textbox is a test case to make sure the code runs successfully. Error

Need to come up with a coding in python.

The blue highlighted textbox is a test case to make sure the code runs successfully.

Need to come up with a coding in python. The blue highlighted

Error Finder Function Name: error_finder Parameters: numList ( list ), indexList ( list) Returns: (average, errorDict) ( tuple ) Description: Write a function that takes in a list of numbers and a list of indices. Note that in- dexList may not only contain valid indices. The function should keep track of the number and type of errors that occur. Specifically, it should account for IndexError and TypeError . It should return the average of all the numbers at valid indices and a dictionary containing the number and type of errors together in a tuple. errorDict should be formatted as follows: {"IndexError": 0, "TypeError": 0} If none of the indices in the indexList are valid, the function should return 0 as the average. >>> numList = [4,5,1,7,2,3,6] >>> indexList = [0, "4", (1,), 18, "", 3, 5.0, 7.0, {}, 20] >>> print(error_finder(numList, indexList)) (5.5, {'IndexError': 2, 'TypeError': 6}) >>> numList = [1, 0, 18, 22, 3, -1, 5, 4, 9] >>> indexList = [(7,), 4.0, {True: False}, 0, [11], "not an index", 12, 2.5] >>> print(error_finder(numList, indexList)) (1.0, {'IndexError': 1, "TypeError': 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!