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
Terrence smiles at his customers, helps his cowokers,and stays late when needed. What personal skill does Terrence demonstrate
adell [148]

Answer: Humility,kindness

Explanation:

5 0
3 years ago
Read 2 more answers
Hello, can you help me answer these questions?
Anna35 [415]

Answer:

Ans 1.To connect to the Internet and other computers on a network, a computer must have a NIC (network interface card) installed. A network cable plugged into the NIC on one end and plugged into a cable modem, DSL modem, router, or switch can allow a computer to access the Internet and connect to other computers.

Ans 2.Data travels across the internet in packets. Each packet can carry a maximum of 1,500 bytes. ... When you send an e-mail to someone, the message breaks up into packets that travel across the network. Different packets from the same message don't have to follow the same path.

Ans 3.protocol is a set of rules that governs the communications between computers on a network. A network protocol defines rules and conventions for communication between network devices.

Ans3 A protocol is a set of rules that governs the communications between computers on a network. A network protocol defines rules and conventions for communication between network devices.

Hope this fine

<h2>Pls Make me a brainlest </h2>
8 0
4 years ago
Read 2 more answers
If a destructive program is running that might be destroying evidence what should be done
Vikentia [17]
The choices can be found elsewhere and as follows:
a. perform an immediate full backup
b. attempt to end the process
c. pull the power cable
d. record the destruction using a video capture of the screen

I think the correct answer is option a. If a destructive program is running that might be destroying evidence, then perform an immediate full backup. 
3 0
3 years ago
Write the function "zipper". the function will take two array/list/table parameters and return a new array/list/table which will
MakcuM [25]
What is the problem what am I supposed to do?
4 0
4 years ago
To arrange data in alphabetical order quickly, you can _____ the data.
Vadim26 [7]
A. Organizing the data makes it easier to to arrange anything.
7 0
3 years ago
Read 2 more answers
Other questions:
  • Type the correct answer in the box.
    7·1 answer
  • 5) How have the wireless web and peer-to-peer networking helped small businesses compete with large corporations?
    15·2 answers
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • Two electronics technicians are measuring electrical quantities in circuits. Technician A says that copper, glass, porcelain, an
    13·2 answers
  • Use the Law of Sines to solve the triangle. Round your answers to two decimal places.
    6·1 answer
  • Clocks (also called timers) are essential to the operation of any multiprogrammed system. They maintain the time of day, and pre
    9·1 answer
  • Write a c++ program to print even numbers from 1 to 20​
    15·1 answer
  • The bag class in Chapter 5 has a new grab member function that returns a randomly selected item from a bag (using a pseudorandom
    8·1 answer
  • State the steps for opening Ms word Application ​
    7·1 answer
  • When was the first computer made?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!