subject

In Python, write a function named teacher that produces a mapping of students' grades. Your function accepts two parameters: a class roster telling you each student's name and percentage earned in the course, and a grade mapping telling you the minimum percentage needed to earn each unique grade mark. The class roster is a dictionary from students' names (strings) to the percentage of points they earned in the course (integers). The grade mapping is a dictionary from percentages (integers) to grades (strings) and indicates the minimum percentage needed to earn each kind of grade. The task of your function is to look at the student roster and grade mapping and use them to build and return a new dict from students' names to the letter grades they have earned in the class, based on their percentage and the grade mapping. Each student should be given the grade that corresponds to the highest value from the grade mapping that is less than or equal to the percentage that the student earned. Suppose that the class roster is stored in a dictionary variable named roster that contains the following key/value pairs, and that the grade mapping is stored in a dictionary variable named grade_map that contains the key/value pairs below it:

roster:
{'Mort': 77, 'Dan': 81, 'Alyssa': 98, 'Kim': 52, 'Lisa': 87, 'Bob': 43, 'Jeff': 70, 'Sylvia': 92, 'Vikram': 90}
grade_map:
{52': D, '70': C-, '73': C, '76': C+, '80': B-, '84': B, '87': B+, '89': A-, '91': A, '98': A+}
The idea is that Mort earned a C+ because his grade is at least 76% Dan earned a B- because he earned at least 80% and so on. If a given student's percentage is not as large as any of the percentages in the dictionary, give them a default grade of "F". So your function should build and return the following dictionary from students' names to their letter grades when passed the above data:

return value:
{'Mort': 'C+', Dan': 'B-', Alyssa': 'A+', Kim': 'D', Lisa': 'B+', Bob': 'F', Jeff': 'C-', Sylvia': 'A', Vikram': 'A-'}
Though dictionaries often store their elements in unpredictable order, for this problem you should process the grade mapping's key/value pairs in ascending order by keys (percentages).

If either dictionary passed to your function is empty, your function should return an empty dictionary. You should not make any assumptions about the number of key/value pairs in the dictionary or the range of possible percentages that could be in the dictionary.

Constraints: You may create one new dictionary as storage to solve this problem. (This is the dictionary you will return.) You may not declare any other data structures. You can have as many simple variables as you like, such as integers or strings. Do not modify the dictionaries that are passed in to your function as a parameter.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
Ihave a singular monitor that is a tv for my computer. recently, i took apart my computer and put it back together. when i put in the hdmi cord and booted the computer to see if it worked, the computer turned on fine but the screen was blue with "hdmi no signal." i've tried everything that doesn't require buying spare parts, any answer is appreciated!
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
To become an audio technician, the most successful tactics might include the following. (select all that apply). learning how to persuade other people gaining different types of experience in audio technology learning as much as possible about art history establishing a reputation as a reliable professional
Answers: 1
question
Computers and Technology, 24.06.2019 02:40
Has anyone seen my grandma shes been gone for 4 years already
Answers: 1
You know the right answer?
In Python, write a function named teacher that produces a mapping of students' grades. Your function...
Questions
question
Chemistry, 30.10.2020 05:30
question
Mathematics, 30.10.2020 05:30
question
English, 30.10.2020 05:30
Questions on the website: 13722363