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
What is the name for unwanted software that installs when you click some links?
Rudik [331]
Malware you're welcome 
8 0
4 years ago
Read 2 more answers
When creating a document template, you can either start from an existing document or begin from _____.
Anna35 [415]
A new blank document
7 0
3 years ago
How to insert header and page number in word 2016?
AleksAgata [21]
Insert - Header - choose header of your choice. Page numbers are below the Header icon

3 0
3 years ago
The _______ hybrid uses 144 to 158 volt batteries.
Andrej [43]

Answer:

Medium hybrid

Explanation with feature:

  • They feature idle-stop function
  • It contain Regenerative braking
  • Most are not capable of using the electric motor alone to propel the vehicle.
  • The electric motor usually assists the engine
  • Battery voltages are about 144 to 158 volts
8 0
3 years ago
What is Aggregate Demand equivalent to?<br><br> A. Real Output<br> B. Nominal GDP<br> C. Inflation
nirvana33 [79]
<span>What is Aggregate Demand equivalent to?

A. Real Output</span>
6 0
4 years ago
Other questions:
  • 11. If the following pseudocode were an actual program, what would it display:
    6·2 answers
  • Brandon purchased a new processor online as an upgrade. When he purchased the processor, he made sure that it used the same sock
    14·1 answer
  • Discuss the software development methodology you would use for developing a software product for insurance agents, and state val
    10·1 answer
  • Write a program with a function that accepts a string as an argument and returns a copy of the string with the first character o
    11·1 answer
  • Who wants to join my zoom after school 23456+4567
    15·1 answer
  • Service-oriented architecture (SOA) provides a way for apps on a network to talk to each other using all these ways, EXCEPT ____
    10·1 answer
  • Which format of image files can be inserted in html?​
    8·2 answers
  • Select the correct answer
    15·1 answer
  • Isla is writing a report on the best roller coasters in America. Which device could help her with this?
    14·1 answer
  • A company is looking to share data between two platforms in order to extend their functionality. which feature enables communica
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!