Design a program that ask the user to enter a series of positive numbers. The user should enter a negative number to the series. After all the positive numbers have been entered the program should display their sum

Answers

Answer 1

Answer:

total = 0

while True:

   number = float(input("Enter a number: "))

   

   if number < 0:

       break

   

   total += number

   

print("The total of the positive numbers entered is", total)

Explanation:

*The code is in Python.

Initialize the total as 0

Create a while loop. Inside the loop:

Ask the user to enter a number. Check the number. If it is smaller than 0 (This means it is a negative number), stop the loop using break. Add the number to the total (cumulative sum). (This way your program keeps summing numbers until you enter a negative number)

When the loop is done, print the total


Related Questions

Help! Will add the brainliest.

Which of the following is a tip for getting a good pet photograph?

A. Always stand when taking the picture to keep the pet away from the camera.
B. Show the pet's personality.
C. Avoid having others with you.
D. All of the above

Answers

Answer:

Show the pet's personality

Explanation:

You want to get to know an animal when you look at their photo. If they are smiling then that will show how happy they are! Also, A is incorrect because sometimes you want to be on the same level as your animal. So crouch down and take that close up! And C is wrong because sometimes it is helpful for someone else to be there.

what advice can you give to learners to achieve their goals​

Answers

Answer:

Never give up, take your time, don't get distracted easily, lock your electronics in a box until you finish your work.

Reach for the stars! Always go the extra mile! Never give up!

In a sentence

If you wanted to become a police officer and you had to read boring books and you wanted to give up, but always think "I should always push myself past my limits, If I gave up then how would i know what I could have become?

Trademark

Owned by me

Anyone who know how to use canva .com please make a logo of the name : Deadly Sins

Answers

Answer:

Yes ma'am as in the anime?

Explanation:

Cuz there's a anime show called 7 deadly sins or just deadly sins?

Answer:

hello give the person above brainlist

Explanation:

Write the function greeting that takes a string as input. That string will be formatted as Name Age Hobby, without any punctuation. greeting should split their response into list elements, then use index values to greet them by name and respond that you enjoy that hobby as well, with the format: ‘Hello, ! I also enjoy !' Make sure your output matches this format! For example, greeting('Jose 17 hockey') # => 'Hello, Jose! I also enjoy hockey!' greeting('Cindy 14 robotics') # => 'Hello, Cindy! I also enjoy robotics!'

Answers

Answer:

The function in Python is as follows:

def greetings(details):

   details = details.split(' ')

   print('Hello, '+details[0]+'!, I also enjoy '+details[2])

Explanation:

This defines the function

def greetings(details):

This splits the input string by space

   details = details.split(' ')

This prints the required output

   print('Hello, '+details[0]+'!, I also enjoy '+details[2])

After splitting, the string at index 0 represents the name while the string at index 2 represents the hobby

Find the total cost of a $125 coat purchased in Los Angeles County where the sales tax is 9%. Use the expression c + 0.09c
A
$11.25
B
$112.50
c
$126.25
0 $136.25

Answers

The answer is B I believe

Price of ETH coin right now?
Don't answer if u don't know.

Answers

Answer:

58,715.40

Explanation:

Other Questions
an essay on a narrow escape (5y+1)-4(y-1) how to solve it As Montag makes his escape from hisentertainment and technology obsessed society,he reflects on how he feels as if he has "left astage behind and many actors," as well as thosewho "ate shadows for breakfast and steam forlunch and vapors for supper. Based on theseLDs, what is Montag pinpointing as a main issuein his society? How does it relate to theirconstant entertainment watching / technologyuse? Next, think about our world: Is there asimilar issue in our society? Do we consume andnourish ourselves with "steam, vapor andshadows"? How might this impact our wellbeingand our society? The concluding paragraph should restate all of the statistics and facts presented inthe body of the research paper.TrueFalse PLEASE HELP.i only have until 3:30ok so, The question is:how does building a road, affect Logging companies? please make a SHORT answer not a LONG one In AIJK, the measure of ZK=90, the measure of ZI=46, and IJ = 9.2 feet. Find thelength of JK to the nearest tenth of a foot.J9.2X46K write a story of an atom below In a class there are 15 students. 8 of them like playing soccer, 6 of them like swimming, and 2 like both and swimming and playing soccer. How many students do not like playing soccer and do not like swimming? 9. Matilda just graduated from college. In order to devote all her efforts to college, she did not hold a job. Matilda just graduated from college. In order to devote all her efforts to college, she did not hold a job. She is going to cruise around the country on her motorcycle for a month before she starts looking for work. Other things the same, the unemployment rate ____________ and the labor force participation rate ______________. Please help me solve this step by step please :( 5 important areas to be included in the executive summary of the business plan Explain why (1/2) sqaured 4 = 1/16 do you think that the present government effectively fixed the problems of the Roman Republic? Explain. coutez le mois et crivez le mois que vous entendez pour complter la phrase. C'est le 25 ?????????? Utopia can be considered a because the author uses humor, irony, and exaggeration in the story to criticize his society.CharacterizationFramePrologueSatire Calcium carbonate decomposes intocalcium oxide and carbon dioxide.The mass of calcium carbonate thatdecomposes is 57 g. At the end ofthe experiment, the mass of theproducts were only 45 g. What canwe conclude from this information? I really need help with this ASAP will get 10 here and if they give me the right answer and not a link to some scam I can't open I will write another "Just because" for the person that gives the right answer 58 more points 2(x+3)=x-4 solving equations What is the classification for this polynomial? 6xyz + xy Click on the correct answer. monomial binomial trinomial 4. A girl walked for 30 minutes. She noticed that she traveled farther in the first 15 minutes ofher walk than in the second 15 minutes,What can she conclude about her walk?A she walked over many hillsBher average speed was faster during the first part of her walkC. she walked in two different directionsD. she was walking at a constant speed