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
- 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]},...]
- For each dictionary in the list, compute the average of each activity i.e., assignments, projects etc.
- Compute the weighted final score using the following formula:
- Make a dictionary where the key is the student's name and the value is the final weighted score rounded to 3 decimal places.
- Return the dictionary
Task 2:
- Define the main function
- 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)
- Call the gradeBook function with the list created
- Print the output from the function call
- 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
Step: 1
Implementation of the gradeBook function and a main function that follows the provided instructions ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started