Question: Python Write a program that asks the user several numbers successively by displaying Number? until the user enters the number 0. The program should then
Python
Write a program that asks the user several numbers successively by displaying "Number?" until the user enters the number 0. The program should then display "All -", or "All +", or "Only 0", or "Neither all +, nor all -" depending on whether the user has entered only negative numbers, or only positive numbers, or only zero, or none of the previous cases. In the latter case (neither all +, nor all -), the program must display "Sum -", or "Sum=0", or "Sum +" depending on whether the total sum of the numbers given by the user is strictly negative, zero or strictly positive.
Example 1
Number? 9
Number? 7.2
Number? 3.4
Number? 0
All +
Example 2
Number? -4
Number? -2.1
Number? 0
All -
Example 3
Number? 0
Only 0
Example 4
Number? -2
Number? 5
Number? -1.1
Number? 0.5
Number? 0
Neither all +, nor all -
Sum +
Example 5
Number? -2.2
Number? 1.1
Number? 1.1
Number? 0
Neither all +, nor all -
Sum = 0
Example 6
Number? -10.5
Number? 1.1
Number? 1.1
Number? 0
Neither all +, nor all -
Sum -
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
