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 23:00
In which part of a professional email should you try to be brief, but highly descriptive?
Answers: 1
question
Computers and Technology, 23.06.2019 06:20
Which text function capitalizes the first letter in a string of text? question 10 options: upper capital first proper
Answers: 1
question
Computers and Technology, 23.06.2019 12:10
2. fabulously fit offers memberships for$35 per month plus a $50 enrollmentfee. the fitness studio offersmemberships for $40 per month plus a$35 enrollment fee. in how many monthswill the fitness clubs cost the same? what will the cost be?
Answers: 1
question
Computers and Technology, 23.06.2019 17:00
*! 20 points! *jeff wants to create a website with interactive and dynamic content. which programming language will he use? a. dhtml b. html c. css d. javascript
Answers: 1
You know the right answer?
PYTHON!HELP!Grade Average with Exceptions

the programmer needs to catch all possible ex...
Questions
question
Mathematics, 21.08.2020 21:01