subject

PYTHON!HELP!Grade Average with Exceptions

the programmer needs to catch all possible exceptions within the program, give an intelligent error message to the user, and allow the user to reenter the data so the program may continue. In the Grade Average program, there are two possible exceptions that can be caused by the user; the user can type in something that is not a number, e. g. 'fred', causing a ValueError, or the user can enter a negative number without entering any numbers to average causing a ZeroDivisionError. You must modify the program to use a loop any place the user enters a number to keep requesting them to enter a number until they enter a number.

You will also add the following function to your program: calculateAverage(sum, count) where sum is the sum to be averaged and count is the count of the numbers in sum. It will return the average which is simply sum/count or it will raise a ValueError if count = 0. In the main logic of the program, you will call calculateAverage to get the average but must catch the ValueError if it is raised.

You will see that by making the program robust, you will more than double the amount of code in the assignment.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
Idon understand these and need some ! ?
Answers: 2
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
question
Computers and Technology, 24.06.2019 13:30
Consider jasper’s balance sheet. which shows how to calculate jasper’s net worth?
Answers: 1
You know the right answer?
PYTHON!HELP!Grade Average with Exceptions

the programmer needs to catch all possible ex...
Questions
question
Mathematics, 07.05.2020 09:57
question
Biology, 07.05.2020 09:57
Questions on the website: 13722359