Question
12.23 Prog Assignment 4 - 2: Sum and Average Download the temp file. Write and test the program using IDLE or PyCharm. Then upload it
12.23 Prog Assignment 4 - 2: Sum and Average
Download the temp file.
Write and test the program using IDLE or PyCharm.
Then upload it here for testing and submission.
Create a Python program (sum_and_average.py) that prompt the user to input numbers (all int) then calculate the sum and average of the entered numbers. The number of the entered numbers is n, meaning, the user can enter as many numbers as he/she wants. To finish entering numbers and calculate sum and average, the user needs to enter 0.
Hint: Use a While loop to prompt the user.
You will complete this program in several steps. For each of the following steps, end the program's output with a newline.
(1) Print the instruction once the program start running. (Submit for 1 point)
Input some integers to calculate their sum and average. Input 0 to exit.
(2) Prompt the user to input numbers. The program should allow the user to input numbers, untill the user input 0. (Submit for 6 points, so 7 points total)
Input some integers to calculate their sum and average. Input 0 to exit. Enter a number: 5 Enter a number: 12 Enter a number: 9 Enter a number: 0
(3) After the user input 0, the program should output the sum and average of the entered numbers. (Submit for 2 points, so 9 points total)
Input some integers to calculate their sum and average. Input 0 to exit. Enter a number: 5 Enter a number: 12 Enter a number: 9 Enter a number: 0 The Sum of the above numbers is: 26.0 The Average of the above numbers: 8.67
(4) What if the user entered 0 for the first number? In this case, the program should inform the user that no numbers entered then exit the program. (Submit for 1 points, so 10 points total)
Input some integers to calculate their sum and average. Input 0 to exit. Enter a number: 0 You did not enter any numbers!12.23 Prog Assignment 4 - 2: Sum and Average Download the tomp file. Write and test the program using IDLE or Pycharn. Then upload it here for testing and submission. Create a Python program (cum_and_avcrage.py) that prompt the user to input numbers (all int) ther calculate the surr and average of the entered numbers. The number of the entered numbers is r, meaning, the user can enter as many numbers as he/she wants. To finish entering numbers and calculate sun ard average the user needs to enter @. Hint: Use a while locp to prompt the user. You will complete this p ogram in several steps. For each of the following steps, and the program's output with a newline. (1) Prnt the instruction once the program start running. (Submit for 1 point) Input some insegers to calculate their sum and average. Input 0 to exit. (2) Promot the user to input numbers. The program should allow the user to input numbers, until the user inout (Submit for 6 points, 307 points total) Input some in-agers to calculate their sum anc avecage. Input 0 to exit. Entor a number: Entor a number: 12 Entor a number: Entor a number: (3) After the user inpute the program should output the sum and averace of the entered numbers. (Submit fo 2 points, 30 9 points total) (3) After the user input o, the program should output the sum and average of the entered numbers. (Submit for 2 points, so 9 points total) Input some integers to calculate their sum and average. Input o to exit. Enter a number: 5 Enter a number: 12 Enter a number: 9 Enter a number: 0 The Sum of the above numbers is: 26.0 The Average of the above numbers: 8.67 (4) What if the user entered 0 for the first number? In this case, the program should inform the user that no numbers entered then exit the program. (Submit for 1 points, so 10 points total) Input some integers to calculate their sum and average. Input 0 to exit. Enter a number: 0 You did not enter any numbers
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