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
What power points feature will you use to apply motion effects to different objects of a slide
neonofarm [45]

Answer:

Animation scheme can be used to apply motion effects to different objects of a slide.

5 0
3 years ago
A function ________ contains the statements that make up the function.
mestny [16]

Answer:

A) definition

Explanation:

3 0
3 years ago
How did Bill Gates benefit from free enterprise? Need a paragraph please. Will give the branliest!!
olchik [2.2K]

Answer:

Bill Gates used his skills and brains to build a business. In conclusion, Bill Gates was very successful with his industry thanks to free enterprise. He, along with his employees and friends, created and almost perfected the software known as Microsoft. The free enterprise system provides the right to private enterprise, which allowed him to choose his own business and to run it without governmental influence. Because he could create his own business and design his own products, Gates was able to specialize in technology.

Explanation:

8 0
2 years ago
HEYY GUYS START REPORTING ALL THE SPAMMERS PLSS!!!!! For the spammers, I hope you go to hell &gt;:c!!!!!!!!!!!
Molodets [167]

Answer:

i totally agree

Explanation:

4 0
3 years ago
MCQ: Which of the following network is confined to a relatively small area?
kobusy [5.1K]

Answer:

<em>D Lan</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em><em>.</em>

3 0
2 years ago
Read 2 more answers
Other questions:
  • Which element of a business document provides additional information but is not a part of the body of the text?
    13·2 answers
  • The name of the opening that lets light into any camera is called ________.
    11·2 answers
  • Which characteristic would be best for a person seeking a career in the Telecommunications pathway?
    15·1 answer
  • The following algorithm should output the t times table in the format:
    6·1 answer
  • How can you tell that a website is valid and reliable
    7·2 answers
  • What is the financial aspect for a business as to what database software they will buy?
    6·1 answer
  • Intelligence is to creativity as _____ is to _____. Group of answer choices spatial intelligence; musical intelligence correct t
    15·1 answer
  • Learning how to use software takes time. So, after customers have learned to use a particular software package, it is easier to
    11·1 answer
  • Set of general format used to write program in any programming language?​
    10·1 answer
  • a benefit of cloud computing is scaling up or down as demand for your services increases or decreases. the word that is most ass
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!