Copy the main template provided in the breakout room activity onto your IDE Add the implementation for the sum_grades(all_categories) function which returns the sum of the weighted average of grades...



  1. Copy the main template provided in the breakout room activity onto your IDE

  2. Add the implementation for the sum_grades(all_categories) function which returns the sum of the weighted average of grades for all categories


The following example will show you how we compute the final grade for the course from categories with weights and grades for those categories.
This is not what needs to be printed out when the user chooses to Compute the grade. This is simply to demonstrate the math behind the computation.


There are 5 categories in this example:


PA : 5.0%


CA : 15.0%


LA : 25.0%


QUIZ : 25.0%


PROJECT : 25.0%


Provided grades: PA grades [100.0, 100.0, 100.0, 100.0, 100.0, 0.0, 95.0]


CA grades [100.0, 100.0, 98.0, 95.0, 0.0, 100.0]


LA grades [100.0, 100.0, 100.0, 5.0, 0.0, 70.0]


Quiz Grades []


Project Grades []


Sum of grades for PA category: 595.00


Sum of grades for CA category: 493.00


Sum of grades for LA category: 375.00


Sum of grades for Quiz Category: 0.00


Sum of grades for Project category: 0.00


Average grade for PA category: 595.00/7 * 0.05 = 4.25


Average grade for CA category: 493.00/6 * 0.15 = 12.32


Average grade for LA category: 375.00/6 * 0.25 = 15.62


Average grade for Quiz category: 0 * 0.25 = 0.00


Average grade for Project category: 0 * 0.25 = 0.00


Total Average grade = 4.25 + 12.32 + 15.62 + 0.00 + 0.00 = 32.20


Pseudo Code for calculating average grade


set overall avg_sum to 0


for category in all_categories: #go through each category list in all_categories set current category grade sum to 0


if len(category) == 2 # if a category only has a name and weight, but no list of grades,


# then treat it as not having any grades for that category,


# in which case you add 0 to avg_sum and move onto the next category otherwise,


for grade in category[2]:


#go through the grades list as added in 2nd index of category list


add value of grade to category grade sum value


add value of ((sum / length of category[2] list) * percentage defined in category[1]) to avg_sum return the avg_sum


In the main program (the grade management system defined in the breakout room lab), add the following lines to prompt the user for computing grade:


elif opt == …: # add the appropriate option key from the menu to compute grades


avg_grade = sum_grades(…) #implement this function in the main file to compute average grade print(f"Average Grade is: {avg_grade}")

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here