Question: Write a Python program that calculates the sum of all positive numbers (including zero) entered by the user. Keep prompting the user for input

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
Step by Step Solution
3.42 Rating (149 Votes )
There are 3 Steps involved in it
5 O mainpy 1 Initialize a variable to store the sum ... View full answer
Get step-by-step solutions from verified subject matter experts
