Question
I am getting the following error The call drop_below({'abc123': 0, 'abc456': 65, 'jms457': 50, 'jms123': 60, 'xyz123': 70, 'xyz456': 80, 'wmw4': 90, 'wmw5': 100, 'tor3':
I am getting the following error
The call drop_below({'abc123': 0, 'abc456': 65, 'jms457': 50, 'jms123': 60, 'xyz123': 70, 'xyz456': 80, 'wmw4': 90, 'wmw5': 100, 'tor3': 88}, 20) did not modify the dictionary.
I'm not sure how to fix this issue.
def drop_below(adict,limit): """ Deletes all students in the dictionary with grades below limit. The dictionary adict has netids for keys and numbers 0-100 for values. These represent the grades that the students got on the exam. Examples: Suppose a = {'wmw2' : 55, 'abc3' : 90, 'jms45': 86} drop_below(a,60) changes a to {'abc3' : 90, 'jms45': 86} drop_below(a,90) changes a to {'abc3' : 90} drop_below(a,95) changes a to {} drop_below(a,50) leaves a unchanged as {'wmw2' : 55, 'abc3' : 90, 'jms45': 86} Parameter adict: the dictionary of grades Precondition: adict is dictionary mapping strings to ints Paramater limit: the cut-off boundary Precondition: limit is a number (int or float) """ # Hint: Create a list of netids to drop, and THEN drop them droplist=[key for key in adict if adict[key]
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started