Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(PYTHON) Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that
(PYTHON) Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he or she is finished providing inputs. After the user presses the enter key, the program should print:
The sum of the numbers
The average of the numbers
An example of the program input and output is shown below:
Enter a number or press Enter to quit: 1 Enter a number or press Enter to quit: 2 Enter a number or press Enter to quit: 3 Enter a number or press Enter to quit: The sum is 6.0 The average is 2.0
BASE CODE
theSum = 0.0 data = input("Enter a number: ") while data != "": number = float(data) theSum += number data = input("Enter the next number: ") print("The sum is", theSum)
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