Question: Make a function called gradeBookwith one parameter which is a list of dictionaries. You can expect the general form of the list of dictionaries as

  1. Make a function called gradeBook with one parameter which is a list of dictionaries. You can expect the general form of the list of dictionaries as follows: [{dict_1}, {dict_2}, ... {dict_n}]. An example argument has also has been presented below:

 

[ { "name": "Emma", "assignments": [10.0,20,30], "projects": [50.0,60.0], "exams": [75,98]},

{"name": "John","assignments": [15, 24, 35, 62.0], "projects": [30, 60],"exams": [40, 70]},...]

 

  1. For each dictionary in the list, compute the average of each activity i.e., assignments, projects etc.
  2. Compute the weighted final score using the following formula:

        finalScore = 0.35 x Avg AssignmentScore + 0.3 x Avg ExamScore + 0.35 x AvgProjectScore 

  1. Make a dictionary where the key is the student's name and the value is the final weighted score rounded to 3 decimal places.
  2. Return the dictionary

 

 

Task 2:

 

  1. Define the main function
  2. Make a list of dictionaries based on the format given in Task 1 with values of your choice. Alternatively, you can use the sample inputs as well. (Do not use input function to get arguments as it interrupts the autograding scripts)
  3. Call the gradeBook function with the list created
  4. Print the output from the function call
  5. Call the main function using " __name__  == __main__" call as done in the previous assignments

 

 

Sample Input/Output:

 

>> stuList = [{"name": "Sam", "assignments": [90.0, 50.0, 75.0, 60.0], "projects": [35.0, 80.0, 72.0],"exams": [42.0, 56.5]}, {"name":"Anna", "assignments": [100.0, 90, 92, 88.0], "projects": [85.0, 75.0, 88.0],"exams": [95.0, 75.0]},{"name": "Maria", "assignments": [60.0, 70, 80.0, 90.0], "projects": [40.0, 80.0, 95.0], "exams": [80, 70]}]

 

>> gradeBook(stuList)

 

>> {'Sam': 60.654, 'Anna': 86.808, 'Maria': 73.833}
 

finalScore = 0.35 x Avg AssignmentScore +0.3 x AvgExamScore + 0.35 x Avg ProjectScore

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Implementation of the gradeBook function and a main function that follows the provided instructions ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!