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
Which statement is true about biometrics as an authentication method?​
Irina-Kira [14]

The statement is true about biometrics as an authentication method in options b and c.

<h3>What is Biometrics?</h3>

Biometrics is the measurement worried in measuring behavior or physiological traits of the human being. It is used for verifying the identification of a specific man or woman. It is probably operated in modes, particularly authentication and enrollment.

The complete question is :

Which of the following are true in biometric systems?

  1. a. For authentication application, a user template is compared against a single template stored in the database.
  2. b. For verification/identification application, a user template is compared against all the templates stored in the database.
  3. c. Multimodal biometrics is used to improve accuracy.
  4. d. None of these.

In the first mode, the facts is used and proven to test who the man or woman is. The second mode is obtaining the man or woman's facts and storing it in a database. Usually, multi-version biometrics are used for enhancing popularity accuracy.

Read more about the authentication :

brainly.com/question/25689052

#SPJ1

3 0
2 years ago
Is it more beneficial to have many folders or is it better to " nest subfolders? Explain your response
riadik2000 [5.3K]
I think it's better to have multiple folders because for say you have 6 school subjects but only have 1 folder how are you going to keep track with all 6 subjects in one folder ? You could use each folder for each subject which would save you a lot of time when it comes to getting out your complete work .You can have one folder such as "Workspace" and have multiple different sub-folders that relate that to "Workspace". Also if you store pictures in a folder, it might be a good idea to separate them into different sub-folders.
3 0
3 years ago
On a DTP project, Morgan is preparing digital files to be sent to a printer. Which word describes the activity that Morgan is pe
VladimirAG [237]

In this activity Morgan is preparing the digital files to a printer  on a DTP project.

Explanation:

DTP project is the creation of documents using page layout on a personal computer. The process of printing digital based images directly to variety of media substrates is known as digital processing.

The digital files like PDFs can be sent directly to digital printing press to print on paper, photo paper, fabric and so on.

They have unique fade rates and different sensitives to the various deterioration mechanisms. DTP is used for graphic designers to create documents.

6 0
3 years ago
Read 2 more answers
When an instance of a class, or object, is specified as a parameter to a method, a reference to the said object is passed to the
OLEGan [10]
Or pointer

VERY similar.
5 0
3 years ago
DO NOT JOIN ANY Z O O M MEETINGS FROM THIS PERSON! IS A TRAP Please help me get them banned!!!!!
s2008m [1.1K]

Answer:

how do i help?

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Do transformers have life insurance or car insurance? If you chose life insurance, are they even alive?
    7·1 answer
  • Regarding an intrusion detection system (IDS), stateful matching looks for specific sequences appearing across several packets i
    9·1 answer
  • Assume that the 100,000 element integer array that you allocated starts at address 0x50000000 in memory, the size of an integer
    6·1 answer
  • Your computer is configured to obtain an ipv4 address and dns server address automatically. what utility will help you to find t
    7·1 answer
  • Help !!!!!
    9·1 answer
  • According to the ethical computer use policy, users should be __________ of the rules and, by agreeing to use the system on that
    11·1 answer
  • Anybody know this question??
    8·1 answer
  • If you have an equipment failure while driving on an expressway, you should
    8·1 answer
  • What software maintain and increase the efficiency of a computer system?
    12·1 answer
  • When evaluating platforms, what is the key factor in ensuring a platform addresses an organization's needs?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!