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
1.
kenny6666 [7]
1. true
2. false
3. true
4. true
5. true

if you would like an elaboration, let me know 
8 0
3 years ago
You started using a new Windows server three months ago. Since that time, you have found that the system slows down and crashes
Brut [27]

Answer: Open Reliability Monitor.

Explanation:

The simplest way to view this information is to open the reliability monitor.

The Reliability Monitor shows you the stability history of a system at a glance and also allows one to see the details of the events that has an effect on reliability on a daily basis.

The reliability and problem history chart which can be seen in the Reliability Monitor helps in keeping track of the overall health of the server on a daily basis.

4 0
3 years ago
Which two components help input data in a computer and select options from the screen, respectively?
Natali [406]

Answer:

Mouse and Keyboard are the devices which can be used to give input to the computer.

Explanation:

Mouse and Keyboard both are connected with the CPU via USB cable. Mouse consists of 3 major buttons, left button(for click to get the task to be done), right button (to get options) and wheel (to scroll up and down the page on screen). Keyboard is use to type text and letters as per need.

3 0
3 years ago
At Moore High, 456 students attended the prom. This is 65 more students than
wlad13 [49]

Answer:

B-15%

Explanation:

5 0
3 years ago
Read 2 more answers
2 of 10
ra1l [238]

Answer:

D

Explanation:

Just took the test

5 0
3 years ago
Other questions:
  • Technician A says a 2:1 gear ratio doubles the amount of torque. Technician B says a 2:1 gear ratio reduces the speed by half. W
    8·1 answer
  • When the wires are connected to the terminals of the battery, what causes electric current in the circuit?
    15·1 answer
  • Can you find the ip address from a physical address
    13·1 answer
  • Select the correct answer. Which of these statements is an explorer most likely to make?​
    6·1 answer
  • In Access, you use the Save As command to save a copy of your data. True or False
    15·1 answer
  • What do u think a creative app must have? <br><br> Please answer the question ASAP!!
    5·1 answer
  • Imagine you are the human resource director for a small video game company that employs around 20 coders, managers, artists, etc
    12·1 answer
  • What is an algorithm?
    11·1 answer
  • Which statement is true with respect to Java?
    12·1 answer
  • Range paramters - for loop<br> question in picture
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!