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
The while loop is also known as what kind of a loop? entry-control loop operational loop infinite loop user-control loop
Alexxx [7]
Entry control loop. Because a while loop can be infinite or not based on whether Boolean given is T or F. So we need to know the preexisting condition before we can solve it.
7 0
1 year ago
Custodial workers that access the terminal area must have a fingerprint background check done and training unless they are escor
tensa zangetsu [6.8K]

Answer:

True they do. mark brainliest.!!!!! please

Explanation:

6 0
2 years ago
What is the impedance mismatch problem? Which of the three programming
kykrilka [37]

Answer:

The problem that created due to the difference in the model of programming language and the database model.

Explanation:

The practical relational model has three components which are as follows

1. Attributes

2. Datatypes

3. Tuples

To minimize this problem  

1. We switch low pass L-Network to high pass L-network

2. We switch high pass L-Network to low pass L-network

3. We use the impedence matching transformer

3 0
3 years ago
Difference between a software package and Integrated software and why users would choose one over the other
ivolga24 [154]

Answer:

Software Package means software which is used collectively, implements alike purposes, or combines alike characteristics and is bundled collectively being one kit from software applications, where as, Integrated software is a combination of software specifically built to operate on almost linked applications.

Explanation:

Users should choose Software Package because of the following reasons:

  • Cheap price compared over buying individual application independently.
  • Opportunity to introduce the total of the applications at the corresponding period or just that applications you require to work.
  • The compatible user interface of individual application over another.
  • The facility to distribute data among applications.
  • Coming updates can refresh every application whole by the corresponding event.
  • Perfect for individual use, licensed use, huge or little company.
  • Every software holds the full-featured transcription.
5 0
2 years ago
The concepts of ________________, _________________, and _________________ for covert acts are pivotal to understanding state-on
DIA [1.3K]

The concepts of Power, anonymity and political utility for covert acts are pivotal to understanding state-on-state interactions within cyberspace.

<h3>What is Anonymity?</h3>
  • Anonymity describes cases where the interim person's identity is anonymous.
  • Some writers have argued that anonymity, though technically accurate, does not capture what is more centrally at stake in contexts of anonymity.
  • The essential concept here is that an individual is non-identifiable, unavailable, or untrackable.
  • Anonymity is seen as a technique, or a way of realizing, sure other values, such as solitude, or liberty.
  • Over the past few years, anonymity tools used on the dark web by offenders and harmful users have drastically changed the ability of law enforcement to use conventional surveillance Techni.

To learn more about Anonymity, refer to:

brainly.com/question/28115737

#SPJ4

3 0
1 year ago
Other questions:
  • An unwanted 'explosion' of inbox messages is called​
    8·2 answers
  • The front surface of the CCD is called the _________
    11·1 answer
  • How do i unblock website on my school computer
    7·2 answers
  • American company Software Unlimited is planning to expand its operations to the Bangor Republic where the group is the primary u
    7·1 answer
  • A _____ is a number that summarizes an encrypted information. digital certificate hash function message digest hash algorithm
    8·1 answer
  • What are candid shots? what are posed shots?
    13·1 answer
  • What will happen when you run this program?
    13·1 answer
  • What feature is available to add a auggestion in the margin of someone else's document.
    11·1 answer
  • What is syllabus of diploma in computer after class 10​
    10·1 answer
  • How does 5G technology enhance the Internet of Things (IoT)?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!