Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 # variable to store user inputting integers
mylist # variable to store the sum of integers
count # variable to count the total number of integers input
# loop till ns input value is not
while n :
# input for the value of an integer
n intinputEnter a number to quit:
# If n is not add n to mylist and increase the count by
if n :
mylist mylist n
count count
# print mylistcount which provides the average of all counted integers
printThe average of numbers is mylistcount
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started