Question: I formulated the code block for a while loop program below, but I have been asked to use try / except instead. Could someone please

I formulated the code block for a while loop program below, but I have been asked to use try/ except instead. Could someone please help with this?
n =0 # variable to store user inputting integers
my_list =0 # variable to store the sum of integers
count =0 # variable to count the total number of integers input
# loop till n's input value is not -1
while n !=-1:
# input for the value of an integer
n = int(input("Enter a number (-1 to quit): "))
# If n is not -1, add n to my_list and increase the count by 1
if n !=-1:
my_list = my_list + n
count = count +1
# print my_list/count, which provides the average of all counted integers
print("The average of numbers is ", my_list/count)

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!