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
Veseljchak [2.6K]
3 years ago
11

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

Answer:

The solution code is written in Python 3

  1. count = 0
  2. sum = 0
  3. num = input("Enter a number: ")
  4. while(num != ''):
  5.    sum += float(num)
  6.    count += 1
  7.    num = input("Enter a number: ")
  8. print("Sum : " + str(sum))
  9. print("Average: " + str(sum / count))

Explanation:

Firstly, we declare two variables count and sum to hold the number of input number and the total of the input number, respectively (Line 1-2)

Next, we prompt user to input the first number (Line 4). While the num is not ' ' (This means it is not "Enter" key), accumulate the num to sum variable and increment count by one (Line 6-8) and then prompt the user to input the next number (Line 9).

At the end, display the sum and average using print function (Line 11 -12).

You might be interested in
What option for deploying software to users provides a link to install an application within Control Panel's Programs and Featur
grin007 [14]

Answer:

This question is related to the  following options:

1. Published  - 2. Delegated -  3. Assigned  - 4. Mandated

And the option within Control Panel > Programs and Features > that includes a link to install an application is ; <em>"Published"</em>  thereby the answer would be <em>(</em><em>1.</em><em>)</em>

7 0
3 years ago
Please help me, I honestly dont know what happened to my laptop.
Alex787 [66]
Restart the whole computer??
7 0
3 years ago
Read 2 more answers
If you could own a large technology Company, which one would it be and why
Lilit [14]
I would own Apple. Because I would be rich and create apple products
6 0
3 years ago
You would like to search for information about storms but not tornadoes. What type of search strategy may be useful?
Norma-Jean [14]

Answer:

boolean search

Explanation:

4 0
3 years ago
Read 2 more answers
Which of these is an output device? keyboard mouse trackpad printer
Firdavs [7]
I think a printer could be wrong
6 0
3 years ago
Read 2 more answers
Other questions:
  • How can i appear offline without fb messenger saying "last active 1 minute ago"?
    5·1 answer
  • Design and implement a class Country that stores the name of the country, its population, its area, and the population density (
    6·1 answer
  • So how do I repost a answer that I already answered to a question because I answered this question but later it told me to repos
    14·1 answer
  • Write a static method named anglePairs that accepts three angles (integers), measured in degrees, as parameters and returns whet
    10·1 answer
  • You can tell that the equals() method takes a ____ argument because parentheses are used in the method call.
    6·1 answer
  • How can you employ one of the most powerful interactive business tools on the Internet today?
    11·1 answer
  • What part of a computer is the most important?
    13·2 answers
  • If I was to sort the months of the year in ASCENDING order alphabetically, which
    11·1 answer
  • What are the factors that affect self-confidence?
    15·1 answer
  • What is the name of the first practical asymmetric cryptosystem that was created?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!