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
Natali5045456 [20]
4 years ago
10

For a list of numbers entered by the user and terminated by 0. Write a program to find the sum of the positive numbers and the s

um of the negative numbers. (Hint: This is similar to an example in this chapter. Be sure to notice that the example given in this chapter counts the number of positive and negative numbers entered, but this problem asks you to find the sums of the positive and negative numbers entered Use Raptor in a reverse loop logic with no on left and yes on right.)
Computers and Technology
1 answer:
Mumz [18]4 years ago
6 0

Answer:

Following are the program in the Python Programming Language

#set variables to 0

positive_sum=0

negative_sum=0

#print message

print("Enter 0 to terminate")

#set the while loop

while(True):

 #get input from the user

 num=float(input("Enter positive or negative numbers: "))

 #set if statement to check condition

 if(num==0):

   break

 elif(num>0):

   positive_sum+=num

 else:

   negative_sum+=num

#print output with message

print()

print("sum of positive numbers: ", positive_sum)

print("sum of negative numbers: ", negative_sum)

<u>Output:</u>

Enter 0 to terminate

Enter positive or negative numbers: 1

Enter positive or negative numbers: 3

Enter positive or negative numbers: 5

Enter positive or negative numbers: -7

Enter positive or negative numbers: -2Enter positive or negative numbers: 0

sum of positive numbers:  9.0

sum of negative numbers:  -9.0

Explanation:

Here, we set two integer data type variables "positive_sum", "negative_sum" and initialize to 0.

Then, we set the while infinite loop inside the loop.

  • Set a variable "num" and get input from the user in it.
  • Set the if conditional statement and check condition the variable "num" is equal to 0 then, loop will terminate.
  • Set the elif statement and check condition the variable "num" is greater than 0 then, add that input and store in the variable "positive_sum"
  • Otherwise, add that input and store in the variable "negative_sum".

Finally, we print the output with the message.

You might be interested in
If you witness physical bullying and want to help, what should you consider first?
SashulF [63]

Answer: C

Explanation:

5 0
3 years ago
Write a MY SQL query to display the name and hire date of all employees who were hired in 1992.
bagirrra123 [75]

Answer:

Select * from Employees where LastName LIKE '%H%' or LastName LIKE '%A%' or   LastName LIKE '%Z%' order by Hiredate(or whatever you put for your year name) desc;

Explanation:

6 0
3 years ago
Choose the web design factor from the drop-down menus that best represents each statement. A. Good web pages stick to the point,
Paladinen [302]

Choose the web design factor from the drop-down menus that best represents each statement.

Answer:

A. Good web pages stick to the point, do not have useless information, and showcase important information.

  • Useful content

B. The best websites clearly present a reason for the creation of the site.

  • Purpose

C. The best websites are pleasing to look at and make you want to click further through the pages.

  • Visually appealing

D. It is important for the web designer to understand the needs, interests, and technology level of the target web page visitor.

  • Audience

E. Good websites make it easy to navigate from one page to the other with relevant links in obvious places.

  • Easy to use
4 0
4 years ago
Yvonne found an article online that relates to her research topic, but the article does not cite the author. What should Yvonne
jonny [76]
Hey there!

If Yvonne found an article that relates to her research topic, but it doesn't cite an author, then she should definitely look up another article that relates to her topic that does cite the author. She shouldn't pretend that the article that cites no author is hers, otherwise she could possibly get her grades lowered.

Hope this helps you.
Have a great day! (:
3 0
3 years ago
Read 2 more answers
Top-down programming divides a very large or complex programming task into smaller, more manageable chunks.
vekshin1

Answer:

A

Explanation:

Top-down is a programming style, the mainstay of traditional procedural languages, in which design begins by specifying complex pieces and then dividing them into successively smaller pieces.

5 0
3 years ago
Other questions:
  • If there is more than one speaker, how should they be all noted?
    9·1 answer
  • Describe data center technology and its relevance to modern-day cloud computing
    14·1 answer
  • SONET: is a standard for optical transmission that currently operates at Terabit per second speeds is almost identical to the IT
    7·1 answer
  • A customer has a computer for a home business, but wants to have another computer as a web server. What would be the best soluti
    11·2 answers
  • As a general rule, what is the size of a brochure?
    11·1 answer
  • Why concurrency control is needed in transaction.
    5·1 answer
  • Why does this happen to me?
    14·1 answer
  • Computer identity theft differs from theft in the real world in what major way?
    11·2 answers
  • Based on what you know about the Sort and Find functions, return to the database file to determine the answers to the following
    7·2 answers
  • In Python, the data structure that stores elements of the same data type is called an array.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!