PYTHON PROGRAMMING Write a program that sums up all positive user input numbers. a) For every iteration output the sum of all positive input values. b) Implement the loop to stop if a negative value is entered. c) The sentinel value, the negative number should not be included in the sum. d) Use a function, sumInput() to calculate the sum and return the list that contains all the input numbers. e) Call the function and print out the list. Output Example: Enter a positive number to sum or enter any negative number to end the program: 8.5 Sum = 8.5 Enter a positive number to sum or enter any negative number to end the program: 7 Sum = 15.5 Enter a positive number to sum or enter any negative number to end the program: 100 Sum = 115.5 Enter a positive number to sum or enter any negative number to end the program: -1 All the numbers: [8.5, 7, 100] Ending Program.
PYTHON
Write a program that sums up all positive user input numbers.
a) For every iteration output the sum of all positive input values.
b) Implement the loop to stop if a negative value is entered.
c) The sentinel value, the negative number should not be included in the sum.
d) Use a function, sumInput() to calculate the sum and return the list that contains all the input numbers. e) Call the function and print out the list.
Output Example:
Enter a positive number to sum or enter any negative number to end the program: 8.5 Sum = 8.5
Enter a positive number to sum or enter any negative number to end the program: 7 Sum = 15.5
Enter a positive number to sum or enter any negative number to end the program: 100 Sum = 115.5
Enter a positive number to sum or enter any negative number to end the program: -1 All the numbers: [8.5, 7, 100]
Ending Program.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images