Question: Function name : average Parameters : num_grades (int) Returns: float or string Description : Write a function called average which takes in an int representing

Function name : average

Parameters : num_grades (int)

Returns: float or string

Description : Write a function called average which takes in an int representing the number of times a user will be prompted to enter a test grade with the string 'Please enter a test grade: ' . With each grade the user enters, the program should keep updating the overall average test grade. If the average grade falls below a 70, return the overall average test grade rounded to one decimal place even if the user has not entered num_grades test grades. For example in the test case shown below, average(4), the function returned the average 57.5 even though the user had not yet entered 4 test grades since the average fell below a 70. Otherwise, the function should continue until the user has entered num_grades test grades and return the overall average rounded to one decimal place. If num_grades is 0, the function should return the string "Not enough grades to calculate average." Your function needs to use a while loop. Assume that the values of the test grades will be greater than or equal to zero.

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!