Modify your program  to use at least one method to perform the same task. You will also need to add exception handling to your program and to your method. MY CODE IS BELOW You can create a method to save the numbers the user entered into a list You can create a method to find the largest number You can create a method to find the average Your method must perform the following  The method must take in at least one value as a parameter. The method must return a value You must use Exception handling in your method

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter11: Exception Handling
Section: Chapter Questions
Problem 1CP
icon
Related questions
Question

Modify your program  to use at least one method to perform the same task. You will also need to add exception handling to your program and to your method.

MY CODE IS BELOW

  • You can create a method to save the numbers the user entered into a list
  • You can create a method to find the largest number
  • You can create a method to find the average

Your method must perform the following 

  • The method must take in at least one value as a parameter.
  • The method must return a value
  • You must use Exception handling in your method

HERE is my code 

numList = []

while(True):
  
    variable = input("Enter a number or Enter done to quit: ")
    
    if(variable=='done'):
       
        break
    
    numList.append(int(variable))
# display the information
print("The total amount of numbers entered : ",len(numList))
print("The total of numbers : ",sum(numList))
print("The average of all numbers : ",sum(numList)/len(numList))
print("The largest number is: ",max(numList))

    

 

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning