1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OlgaM077 [116]
3 years ago
14

Course Aggregation Many times, departments are only interested with how students have done in courses relative to a specific maj

or when considering applicants for admission purposes.
For this problem you are given a dictionary where the keys are strings representing student ids and the values are dictionaries where the keys represent a course code and the value represents a grade. Your task is to write a function that given a dictionary of the described format and a prefix for course codes, return a dictionary where each key is a student id and the corresponding value is the average grade of the student only in courses that start with the given prefix.
def course_grader (student_to_grades, course_prefix): ({str, {str, float}}) -> {str, float} I: a dictionary containing the grades of students (as described above) and a course code prefix P: compute and store the average grade of all students only for courses that start with the given course prefix 0: a dictionary of student ids to average grades as described in the Processing step pass
Computers and Technology
1 answer:
nadezda [96]3 years ago
8 0

Answer:

def course_grader(student_to_grades, course_prefix):

   student_grades = dict()

   for key, value in student_to_grades.items():

       grade_score = 0

       for course,grade in value.items():  

           if course_prefix == course:  

               grade_score += grade

                student_grades[key] = grade_score / len(value.keys())

   return student_grades

Explanation:

The course_grader function is a python program that accepts two arguments, the student dictionary and the course prefix. The function returns a dictionary of the student id as the key and the average grade of the student as the value.

You might be interested in
How can you ensure that the website you are using is secured?
poizon [28]
By having the lock by the website address
3 0
3 years ago
Which of the following should businesses and organizations do to promote a safe work environment?
nlexa [21]
<span>The correct answer should be A.Hold managers, supervisors, and employees for meeting their own responsibilities. The policies should be changed more often than every 10 years, and definitely the workers should be involved because the workers know better what is problematic than managers who sit in offices in suits and aren't exposed to dangerous activities.</span>
8 0
3 years ago
11111 Power 2 sovle ​
erastovalidia [21]
123,454,321. you just multiply 11111 by itself
4 0
3 years ago
Different he launc.<br>in function are available with MS-Excel<br>Many​
Kruka [31]

functions are available with MS-Excel..

1.count and sum

2.cell references

3.data and Time

4.text

5.lookup and reference

6.finanical

7.round

8.array formula

7 0
3 years ago
Which is the most popular language used in game programming?
ANEK [815]

Answer:

B C++

Explanation:

The two most common languages for game designers to learn are C++ and Java, although other languages are popular (such as C# for Unity). Another type of programming you may hear referred to is scripting, but that essentially comes down to a type of systems programming.

4 0
3 years ago
Read 2 more answers
Other questions:
  • Regarding computer protection, quarantining is defined as ________. Select one: A. placing a found virus in a secure area on the
    13·1 answer
  • When you define a table's primary key, the dbms automatically creates a(n) _____ index on the primary key column(s) you declared
    14·1 answer
  • To share a document in my online electronic journal, I should select the option to _____.
    14·1 answer
  • What is a complex instruction set computer chip? Multiple Choice Performs all arithmetic operations (for example, addition and s
    6·1 answer
  • solve this simple question 1) Let S = {a, bb, bab, abaab} be a set of strings. Are abbabaabab and baabbbabbaabb in S*? Does any
    8·1 answer
  • Today when Dylan turned on his computer, he noticed that the monitor was very dim. He could still see the desktop icon and text.
    15·1 answer
  • A corporation needs an operating system that allows the various teams in its office to network and collaborate on projects. Whic
    13·2 answers
  • 1. What does a network allow computers to share?
    13·1 answer
  • Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a
    7·1 answer
  • To print photographs in color.​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!