1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nataly_w [17]
1 year ago
8

Edit the program provided so that it receives a series of numbers from the user and allows the user to press the enter key to in

dicate 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

This is what I have but it just keep going with the numbers
# Edit the code below
theSum = 0.0
count = 0
while True:
number= input("Enter a number or press Enter to quit:")
if number=="":
break
theSum+=float(number)
count+=1
print("The sum is", theSum)
if count>0:
print("The average is ", theSum/count)
Computers and Technology
1 answer:
BlackZzzverrR [31]1 year ago
8 0

The edited and complete program is as follows

theSum = 0.0

count = 0

while True:

   number= input("Enter a number or press Enter to quit:")

   if not number:

       print("The sum is", theSum)

       if count>0:

           print("The average is ", theSum/count)

       exit()

   theSum+=float(number)

   count+=1

<h3>How to edit the program?</h3>

The complete program that calculates the average and the sum of numbers entered by the user is as follows:

Note that the program ends when the user presses the enter key and comments are used to explain each line

#This initializes the sum

theSum = 0.0

#This initializes the counter

count = 0

#This ensures the user enters numbers repeatedly

while True:

   #This gets the input

   number= input("Enter a number or press Enter to quit:")

   #When the user presses enter

   if not number:

       #This prints the sum and the average

       print("The sum is", theSum)

       if count>0:

           print("The average is ", theSum/count)

       #This exits the program

       exit()

   #This calculates the sum

   theSum+=float(number)

   count+=1

Read more about python programs at

brainly.com/question/26497128

#SPJ1

You might be interested in
In Microsoft word you can access the ______ command from "mini toolbar"
Mashcka [7]
Redo command, i think.
8 0
3 years ago
Read 2 more answers
4. What is a pentaprism? What job does it do in the camera?
Nadya [2.5K]
Pentaprism is a five sided prism with two silvered surfaces giving a non-stop deviation of all rays of light through 90 degress. Used in viewfinders of single-lens reflex cameras 
6 0
3 years ago
Read 2 more answers
In the context of IT jobs in the information systems field. A ____ is responsible for database design and implementation
Yuri [45]

Answer: Database Administrator.

A Database Administrator is responsible for any design and implementation of a database in a system. They are also the people who make sure that they can secure and manage all the data in their system to avoid any problems that may occur during its usage.

They also are responsible for keeping track of changes and the accessibility of the users that will be inputting data into the database. This most especially applies to databases that are meant to keep client information and transactions for most companies.

8 0
3 years ago
Read 2 more answers
An electronic cover letter should be
Lunna [17]
A cover letter is a document sent with your resume to provide additional details about you. The cover letter is what introduces your resume and you. 
<span>A few short tips for writing cover letters. i dont know if thats the answer you looking for</span>
3 0
3 years ago
Read 2 more answers
If you know batch coding, can you see if there is anything wrong with this script, or if you can make any suggestions to modify
zzz [600]
There isn't an opening and closing parentheses for the else statement. PM me. I know a lot of batch...
8 0
3 years ago
Other questions:
  • What software is typically used for larger systems?
    11·1 answer
  • Who is the last person appointed to the u.s supreme court
    11·1 answer
  • If you delete a sent message on gmail does the person still get it
    14·1 answer
  • What pressure will be shown on the high side peessure gauge (ac system on)
    12·1 answer
  • Which type of software is the most similar to database software?\
    5·1 answer
  • A location in memory used for storing data and given a name in a computer program is called a because the data in the location c
    14·1 answer
  • Adding Web pages helps Web designers ___. Choose all answers that are correct.
    13·1 answer
  • describe how sodium ammonium chloride can be separated from a solid mixture of ammonium chloride and anhydrous calcium chloride​
    15·1 answer
  • Why does computer uses 0s and 1s to procress data​
    7·2 answers
  • The most common markup language used with web pages is ___________ Question 4 options: A. HTML B. VRML C. Javascript
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!