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]
2 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]2 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
Show the subnet address, subnet mask in slash notation, broadcast address, number of addresses, first valid host address, and th
sineoko [7]
Subnet 102.176.0.0/12
broadcast 102.191.255.255
lowest 102.176.0.1
highest 102.191.255.254
7 0
3 years ago
False when you tap or click the ‘decrease font size’ button, excel assigns the next lowest font size in the font size gallery to
castortr0y [4]
That is actually true. In order to format the font, margins and alignment of a form you need to s<span>elect the control that you want to format, then right-click the selection, and then click Format Control. What you do next is that on the Font tab you select the font type, font style, font size, other formatting options for the selected text and in order to finish to press ok </span>
6 0
3 years ago
A wireless (radio) transmission of data can only travel a short distance.<br><br> True or false?
timofeeve [1]

I believe this is false as some radio waves can travel beyond our solar system

7 0
2 years ago
What are the factors that affect self-confidence?
denis-greek [22]

Answer:

The factors that affect self confidence are not having enough faith in yourself and letting what others say about you put you down

Explanation:

Plz mark brainlest it will help me so much

5 0
2 years ago
1. Railroad tracks present no problems for a motorcyclist.
Yuki888 [10]

Answer: 1 is A

2 is D

Explanation:

3 0
2 years ago
Other questions:
  • You're allowed to use a cell phone while driving as long as there isn't any oncoming traffic.
    8·2 answers
  • Which statement best describes the Tell Me feature in PowerPoint 2016?
    8·1 answer
  • Which term describes the distance from one point on a wave to the same point on the next wave?
    13·2 answers
  • In which situation is coauthoring of presentations primarily utilized?
    9·1 answer
  • Three reasons Why we connect speakers to computers
    15·2 answers
  • Edhesive 9.3 code practice
    11·1 answer
  • HELP!!!
    15·2 answers
  • Is e commerce a challenge or opportunity to the freight forwarder
    8·1 answer
  • What is output by the following line of code?
    15·1 answer
  • What are common considerations businesses need to make before purchasing new computers? Check all of the boxes that apply.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!