Write a Python program that calculates the sum of all positive numbers (including zero) entered by...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a Python program that calculates the sum of all positive numbers (including zero) entered by the user. Keep prompting the user for input until they enter a negative number. Use a while loop to achieve this. (See the sample outputs for clarification) Sample 1: Enter a positive number: 5 Enter a positive number: 0 Enter a positive number: 3 Enter a positive number: -1 The sum of all the positive numbers is: 8 Sample 2 : Enter a positive number: 44 Enter a positive number: 12 Enter a positive number: -5 The sum of all the positive numbers is: 56 Write a Python program that calculates the sum of all positive numbers (including zero) entered by the user. Keep prompting the user for input until they enter a negative number. Use a while loop to achieve this. (See the sample outputs for clarification) Sample 1: Enter a positive number: 5 Enter a positive number: 0 Enter a positive number: 3 Enter a positive number: -1 The sum of all the positive numbers is: 8 Sample 2 : Enter a positive number: 44 Enter a positive number: 12 Enter a positive number: -5 The sum of all the positive numbers is: 56
Expert Answer:
Answer rating: 100% (QA)
5 O mainpy 1 Initialize a variable to store the sum ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Given the following digital circuit design: A 10. C D MUX MUX MUX F B- What is the output F? 0
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
You need to prepare the financial statement and the adjusting entries for the December31st year end (using EXCEL) for a company that follows IFRS and has a December 31st year end. The company has a...
-
Though the McDonalds (MCD) menu of hamburgers, cheeseburgers, the Big Mac, Quarter Pounder, Filet-O-Fish, and Chicken McNuggets is easily recognized, McDonalds financial statements may not be as...
-
Explain how the liquidity position of finance companies differs from that of depository institutions such as commercial banks.
-
Determine the outcome of the following rotations: ( /2)
-
Holze Music Co. issued 5\%, 10 -year bonds payable at 75 on December 31, 2006. At December 31, 2009, Holze reported the bonds payable as follows: Holze uses the straight-line amortization method....
-
The following financial statement information was prepared for Blue Corporation and Sparse Company at December 31, 20X2: Blue and Sparse agreed to combine as of January 1, 20X3. To effect the merger,...
-
Briefly describe how inflation, or purchasing power, impacts stated or nominal interest rates.
-
John and Sandy Ferguson got married eight years ago and have a seven-year-old daughter, Samantha. In 2020, John worked as a computer technician at a local university earning a salary of $152,000, and...
-
1. Provide a critique of the use of the dividend growth model and the Capital Asset Pricing model as ways to estimate the cost of equity for a company. 2. Provide 3 arguments why business should take...
-
Why do some firms tend to pay lower cash dividends, but also use stock repurchases in addition to distributing cash?
-
search about Toronto stock exchange what is it? what are the functions? how shares are listed etc. Then compare it with New York Stock Exchange. What is the difference and what are the similarities?
-
Charlene is a first-time homebuyer and has found the condo of her dreams with a purchase price of $650,000. Charlene needs to know if her savings will cover the down payment if she chooses the...
-
a. Has J&W's liquidity position improved or worsened? Explain. Current ratio Quick ratio 2021 Inventory turnover Days sales outstanding (days) Fixed assets turnover Total assets turnover The firm's...
-
Use the information below to answer the questions: Purchase unit Usage rate Order period Lead time = 10-lb poly bag (ground beef) 170 lb per day = Safety level = 1 day a. How many pounds should be...
-
Calculate occupancy percentage from the following: Total number of rooms available 130, total sales revenue $6900, ADR $92.
-
Fred Farmer needs to prepare a balance sheet for his bank. He spent the day getting the following information. Fred needs your help to build a balance sheet and evaluate it. The information was...
-
On July 1, 2012, Ted, age 73 and single, sells his personal residence of the last 30 years for $365,000. Ted's basis in his residence is $35,000. The expenses associated with the sale of his home...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-6. On December 12, Irene purchased the building where her store is located. She paid...
-
Diego, age 28, married Dolores, age 27, in 2012. Their salaries for the year amounted to $46,479 and they had interest income of $3,500. Diego and Dolores' deductions for adjusted gross income...
-
Since the management of a company is responsible for its financial statements and the auditor is responsible only for the report, management may choose the form of presentation and the degree of...
-
For each one of the following statements indicate whether the statement is true or false. a. Use of a computer for significant accounting applications does not in any way change specific audit...
-
The following questions relate to the use of computer-assisted audit techniques. Select the best response. a. Which of the following is true of generalized audit software packages? 1. They can be...
Study smarter with the SolutionInn App