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
PtichkaEL [24]
3 years ago
8

Write a program in python that reads an unspecified number of integers from the user, determines how many positive and negative

values have been read, computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point with 2 digits after the decimal. Here is an example of sample run: Enter an integer, the input ends if it is 0: 1 Enter an integer, the input ends if it is 0: 2 Enter an integer, the input ends if it is 0: -1 Enter an integer, the input ends if it is 0: 3 Enter an integer, the input ends if it is 0: 0 The number of positivies is 3 The number of negatives is 1 The total is 5 The average is 1.25
Computers and Technology
1 answer:
blondinia [14]3 years ago
6 0

Answer:

count_p = 0

count_n = 0

total = 0

while True:

   number = int(input("Enter an integer, the input ends if it is 0: "))

   if number == 0:

       break

   else:

       total += number

       if number > 0:

           count_p += 1

       elif number < 0:

           count_n += 1

print("The number of positives is: " + str(count_p))

print("The number of negatives is: " + str(count_n))

print("The total is: " + str(total))

print("The average is: " + str(total / (count_p + count_n)))

Explanation:

Initialize the variables, count_p represens the number of positives, count_n represents the number of negatives, and total represents the total of the numbers

Create a while loop iterates until the user enters 0. If the number is not 0, then add it to the total. If the number is greater than 0, increase count_p by 1. If the number is smaller than 0, increase count_n by 1.

When the loop is done, print the count_p, count_n, total, and average

You might be interested in
Dayla is concerned about managing her digital footprint. What does she mean by this? *
Ludmilka [50]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

First we know what is digital footprint.

A digital footprint is a trail of data you create while using the Internet. It includes the websites you visit, emails you send, and the information you submit to online services.

So, Dalya is concerend about managing her digital footprints means she has concerned to store password that used to be login and make them secure, the email she is sending to the correct address and text in the email is grammatically correct, information that she is submitting online does not violate the security concerns, etc.  

6 0
3 years ago
To add text to a slide when using presentation software, you need to add a text box. To add a text box, click the Text Box butto
Amiraneli [1.4K]

The answer is the second choice, "Insert."


On Microsoft Powerpoint, when you click on the insert tab you can find the text box button.

3 0
3 years ago
Read 2 more answers
What letter names the drive where windows most commonly stores data and files
Degger [83]

the (C:) drive is the default most of the time unless you go and change the partition letter.

5 0
3 years ago
Infrastructure as a Service (IaaS) replaces the _________ of the computer hierarchy with an Internet-based infrastructure.
snow_tiger [21]

Answer:

Digital level logic through machine level

Explanation:

Infrastructure as a Service can be regarded as computing cloud services that allows computation, storage, server in the cloud.it helps the user to access infrastructure in the cloud

Digital level logic which is in digital circuit that allows boolen expression, it allows signals as well as sequence to be expressed in form of numbers, it is usually view as been complicated but not.

It should be noted that Infrastructure as a Service (IaaS) replaces the Digital level logic through machine level of the computer hierarchy with an Internet-based infrastructure.

5 0
3 years ago
Taking into account recent technological developments, what technical advances do you think are possible in the next twenty year
stiv31 [10]

Nuclear Fusion reactors may reach the prototype commercial stage , The causes and possible treatment of Alzheimers Disease  and Partial cloning of human organs for transplant therapy

Explanation:

Fusion may be an energy technology that seems to be perpetually coming over the horizon, but projects around the world such as SPARC are getting increasingly close to reactors that, although smaller in capacity, can produce net positive power in just a few years. To help accelerate discovery of permanent cure for Alzheimers, an alliance of pharmaceutical companies, nonprofit foundations and government advisers, has developed a partnership to share data from Alzheimer's clinical trials. This would definitely pave way for the permanent cure for Alzheimer. The most common method of therapeutic and reproductive cloning is somatic cell nuclear transfer (SCNT). SCNT involves separating the nucleus from a donor egg, and replacing it with the DNA from the organism meant to be cloned. Scientists could potentially clone organs with SCNT by cloning embryos, extracting the stem cells from the blastocyst, and stimulating the stem cells to differentiate into the desired organ. these three scientific and technological advancements are possible.

8 0
3 years ago
Other questions:
  • A software program that allows a programmer to type in code. modern versions usually make it easy to format the code on the scre
    13·1 answer
  • You will write a program that generates random drawings that can be drawn using the shape painter.
    5·1 answer
  • The operation of early electronic computing devices required:
    8·1 answer
  • Which tasks can be completed using the Chart Tools Design tab? Check all that apply.
    9·1 answer
  • A _______ area network is a type of wireless network that works within your immediate surroundings to connect cell phones to hea
    9·2 answers
  • Discuss the challenges of not using the five elements of multimedia in a positive manner<br>​
    7·1 answer
  • Using the drop-down menu, complete these sentences to describe algorithms. Algorithms are instructions to solve a problem. Algor
    12·2 answers
  • Indicate whether the following statements are true or false:
    14·2 answers
  • Anybody know #3 ? I need two ppl to answer this !! Free Brainliest!!
    14·2 answers
  • Plz plz plz help me with me
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!