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
The Subset Sum problem is a generalization of the Knapsack problem. Group of answer choices True False g
Katarina [22]

Answer: True

Explanation:

Subset sum problem and Knapsack problem can be solved using dynamic programming.

In case of Knapsack problem there is a set of weights associative with objects and a set of profits associated with each object and a total capacity of knapsack let say C. With the help of dynamic programming we try to include object's weight such that total profit is maximized without fragmenting any weight of objects and without exceeding the capacity of knapsack, it is also called as 0/1 knapsack problem.

Similar to knapsack problem, in subset sum problem there is set of items and a set of weights associated with the items and a capacity let say C, task is to choose the subset of items such that total sum of weights associated with items of subset is maximized without exceeding the total capacity.

On the basis of above statements we can say that subset sum problem is generalization of knapsack problem.

4 0
3 years ago
What are two benefits of consumer programs
Tcecarenko [31]

They help consumers identify the best product reviews from various sources.

They help prosecute companies that sell unsafe products to consumers.

5 0
3 years ago
Identify the menu under which you'll find the Header and Footer option.
Genrish500 [490]

The answer is B. View.

4 0
3 years ago
You can increase your efficiency by using your e-mail program's spell checker because it eliminates the need for you to proofrea
galina1969 [7]
The answer is True bc it saves you time and is efficient
6 0
3 years ago
If you want to selectively darken an area of an image you could use the
DerKrebs [107]
Create an adjustment layer and create a hue and saturation layer. You'll see sliders so adjust them to your liking. next select a layer mask and fill it will black. then select which areas you want to darken and use the wand tool. Apply a gradient mask if you want. 
5 0
3 years ago
Other questions:
  • _____ is a valuable tool that enables you to find information on the web by specifying words or phrases know as keywords- which
    14·1 answer
  • How can you best utilize CSS for Web Development?
    6·1 answer
  • This formatting option functions like a space bar. However, instead of moving one space at a time, it allows you to move your te
    6·1 answer
  • My current lesson is The Excel Screen and Worksheets and the question is:
    6·1 answer
  • _______ make up the basic structure of a relational database with columns containing field data and rows containing record infor
    6·2 answers
  • The linear programming ingredient or blending problem model allows one to include not only the cost of the resource, but also th
    14·1 answer
  • Why are control components necessary in traditional software and generally not required in object-oriented software?​
    11·1 answer
  • ¿Por qué es importante aprender a programar?
    9·1 answer
  • Mechanisms that can be used to rescue accident victims
    11·1 answer
  • Take any software or Application that you have recently purchased, this can be a video game or any other application helping you
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!