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
Vadik is creating a program where the user inputs their grade level and the program tells them which sports teams they are allow
Lelechka [254]
He should use if, elif, else
4 0
2 years ago
Read 2 more answers
The purpose of an Internet _____ is to receive packets and send them along towards their final destination.
Bumek [7]

The tool that receives packets and send them along towards their final destination is; Internet Server

<h3>Internet Servers</h3>

We are told that the tool is used to receive packets and send them along towards their final destination.

  • Now, the tool is an internet server because internet servers are softwares and hardwares that make use of HTTP and other protocols to respond to client requests that are made over the World Wide Web.

Now, the main job of an internet server is to display website content through storing, processing and delivering webpages to the final destination.

Read more about internet server at; brainly.com/question/20602197

7 0
2 years ago
4. What two important events occurred early in the formation of the universe?
Annette [7]
C. When they separated it created the big bang
4 0
3 years ago
Which function can be used to insert the current date into a spreadsheet?
VladimirAG [237]

Answer:

im pretty sure it MM/DD/YYYY

Explanation:

3 0
3 years ago
What kind of server is another computer that screens all your incoming and outgoing messages?
Rom4ik [11]
A proxy server
Hope i could help
8 0
3 years ago
Other questions:
  • Here's something to stop you from getting repetitive when writing essays. Write a program that reads multiple lines of plain tex
    15·1 answer
  • Within the hardware of the personal computer temporary memory is known as
    10·2 answers
  • Where do today's computers store almost all motherboard configuration data?
    15·1 answer
  • Write a program reverse-order.cpp which asks the user to input two dates (earlier date then later date). The program should repo
    13·1 answer
  • What does "FDDI" stand for in Technology?
    5·2 answers
  • The Active Directory Users and Computers tool can be used to:______.
    11·1 answer
  • What will you see on the next line?
    6·2 answers
  • Use the drop-down menus to complete the statements about changing mail options in Outlook.
    10·1 answer
  • The network backbone
    11·1 answer
  • Which type of protocol provides a way to transfer files from one computer to another over any tcp/ip network, such as a lan or t
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!