Question: For this problem you will write a rather useful program: one that takes in a description of course-grading & grades received and outputs the resulting

For this problem you will write a rather useful program: one that takes in a description of course-grading & grades received and outputs the resulting average grade. As is often the case when writing programs, we make an important assumption: within a category of grades (e.g. "HW"), all individual grades count the same.

Consider a simple example:

> python coursegrade.py

Enter grade weights: 10 90

Enter grades (10%): 60

Enter grades (90%): 70 73

Course grade: 70

Here we have described a course that has two categories of grades: the first counts for 10% of the total, and the second for the remaining 90%. We then ask for grades received in each of the categories (in the same order in which weights were provided). In the example the student received a 60 for the sole assignment in the 10% category, and a 70 and 73 for two assignments in the 90% category. The given weighting implies that we calculate the final course grade as: (0.1)((60)/1) + (0.9)((70 + 73)/2) = 70.35 70.

Now consider a second, more complicated example (that looks a lot like this class!). . .

> python coursegrade.py

Enter grade weights: 30 20 25 25

Enter grades (30%): 100 90 80 70 60 60 70 80 90 100

Enter grades (20%): 90 80 100 70 60

Enter grades (25%): 100 100 100 50 0 100 100 100 100 100

Enter grades (25%): 90.8

Course grade: 84

Note #1: You do not know ahead of time how many graded categories will be entered, nor how many grades for each category; however, you can assume they will all be numbers and separated by spaces.

Note #2: You have been supplied some code in the starter file - do not change this, simply supply your own code where indicated and then comment your code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!