Question: Write a function weighted_grade () that computes the weighted average of a series of user-entered grades. The function should (1) repeatedly ask the user for

 Write a function weighted_grade () that computes the weighted average of

Write a function weighted_grade () that computes the weighted average of a series of user-entered grades. The function should (1) repeatedly ask the user for a grade and a corresponding weight until they enter the empty string, (2) compute the weighted average of the entered grades, (3) print the result. Lig;W; The formula for a weighted average with grades g and weights w is , , In other words, the weighted average is the sum of each weight multiplied by each grade, divided by the sum of weights. This example shows the correct behavior of the function: >>> weighted_grade () Enter a grade: 90 Enter a weight: 3 Enter a grade: 100 Enter a weight: 2 Enter a grade: Your weighted grade is 94. This is correct because (90 3 + 100 2)/(3 + 2) = 94. Note that once the user enters the empty string for a grade, the function immediately prints the final result and does not ask for another weight. You can assume that the user will enter positive numeric values with or without decimals for both grades and weights. You can also assume that the user will enter at least one grade and weight pair

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 Databases Questions!