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 04:00
Chloe is building a kiosk-based excel application. she wants to make some modifications to the screen elements in order to keep users from being distracted by parts of the application that are irrelevant to her application. she turns to henry for guidance as she knows he built a similar solution earlier this year.chloe has decided to hide the worksheet gridlines and the vertical scroll bar. what does henry tell her to use to do this? a) screen elements dialog boxb) display options dialog boxc) customization dialog boxd) excel options dialog box
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Design a class tictactoe that: holds the following information about the game: two-dimensional array (3 by 3), and winner. add additional variables as needed. includes the functions to perform the various operations on objects. for example, function to print the board, getting the move, checking if move is valid, determining if there is a winner after each move. add additional operations as needed. includes constructor(s). write the functions of the class, and write a program that uses the class. the program should declare an object of type tictactoe. the program will create the board and store it in the array. the program will allow two players to play the tic-tac-toe game. after every valid move update the array, check if there is a winner. if there is no winner and no tie, then print the board again to continue.
Answers: 2
question
Computers and Technology, 24.06.2019 01:00
Answer these and get 40 points and brainliest
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
Social Studies, 24.01.2020 01:31
question
Social Studies, 24.01.2020 01:31
Questions on the website: 13722365