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
Rom4ik [11]
3 years ago
10

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 o

r 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)
Computers and Technology
1 answer:
kogti [31]3 years ago
5 0

Answer:

theSum = 0.0#defined in the question.

count=0 #modified code and it is used to intialize the value to count.

data = input("Enter a number: ") #defined in the question.

while data != "": #defined in the question.

   number = float(data) #defined in the question.

   theSum += number #defined in the question.

   data = input("Enter the next number or press enter to quit ") #defined in the question "only some part is modified"

   count=count+1#modified code and it is used to count the input to print the average.

print("The sum is", theSum)#defined in the question.

print("The average is", theSum/count) #modified code and it is used to print the average value.

output:

  • If the user inputs as 1,4 then the sum is 5 and the average is 2.5.

Explanation:

  • The above code is written in the python language, in which some part of the code is taken from the question and some are added.
  • The question has a code that tells the sum, but that code is not print the average value of the user input value.
  • To find the average, some codes are added, in which one count variable which is initialized at the starting of the program and gets increased by 1, when the user gives the value.
  • Then that count divides the sum to print the average.
You might be interested in
Desktop publishing design tools are represented by
alina1380 [7]

<span>A. icons.
B. windows.
C. trackballs.
D. modems.</span>

Desktop publishing design tools are represented by <span>icons. The answer is letter A. This is the easiest way to access the design tools when in need.</span>

5 0
4 years ago
Please explain why an operating system makes a great attack target.​
BartSMP [9]
The operating system is the fundamental controller of all system resources
Operating system popularity is one major reason why hackers attack
Window is a big target because it powers the vast majority of the world’s desktop computers and laptops.
To steal personal and protected health information
To steal user credit card numbers and other financial data
To harm the system or disrupt business operations of any organization
To gain competitive edge over opponents
To spoil the reputation of an organization

If you want answer to question 19, put a Thanks and comment that you want answer to question 19
8 0
3 years ago
Iwhen using excel when is the best time to use the add paste special function ?
dem82 [27]
When pasting a graph in to the excel line or work or when passiting a cell to another cell.

6 0
3 years ago
What are some of the challenges that could arise from setting up a file management system on a computer?
son4ous [18]
It could glitch out or be hacked or deleted.
8 0
4 years ago
During the weekend, Alice often needs to access files stored on her office desktop from her home laptop. Last week, she installe
ICE Princess25 [194]

Answer:

Depending on the error message which Alice get but what could have gone wrong is perhaps firewall issue.

Explanation:

There are lots of probable reason why Alice could not access her files during the weekend but below are some common reasons:

Firewall issue: Maybe Alice has her firewall turned on unknowingly as it is known that firewall do block such types of connection except it is explicitly allowed from the firewall settings.  Another issue might be that, Alice ISP uses firewall.

FTP programs Setting: Perhaps there is a settings which Alice has not activated in the FTP program that she is using.

3 0
4 years ago
Other questions:
  • Which of these does an open office or Microsoft Office wizard do?
    7·1 answer
  • You connect three 0.5 volt lights in series. Each light has a resistance of 25ohms. Answer the following.
    9·1 answer
  • . Briefly describe an SQL DML statement for storing new data into a table.
    9·1 answer
  • The ____ causes the network to settle into a stable state where it can correctly respond, to any desired degree of accuracy, to
    5·1 answer
  • In what ways was the first Mac OS different from the operating systems used by most early PCs? Users clicked on pictures to laun
    12·1 answer
  • What is Systems Engineering?
    5·1 answer
  • To which of these options does the style in Word apply? Select three options.
    7·1 answer
  • Which printing method transfers the ink from a metal plate to a rubber blanket?
    13·1 answer
  • Mario has a friend who uses assistive technology. Complete the paragraph to describe how Mario can make his document useful to h
    9·2 answers
  • Scott sends his backups to a company that keeps them in a secure vault. What type of backup solution has he implemented?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!