Question: Implement function inValues() that asks the user to input a set of nonzero floatingpoint values. When the user enters a value that is not a
Implement function inValues() that asks the user to input a set of nonzero floatingpoint values. When the user enters a value that is not a number, give the user a second chance to enter the value. After two mistakes in a row, quit the program. When the user enters 0, the function should return the sum of all correctly entered values. Use exception handling to detect improper inputs.
>>> inValues()
Please enter a number: 4.75
Please enter a number: 2,25
Error.
Please re-enter the value.
Please enter a number: 2.25
Please enter a number:
0 7.0
>>> inValues()
Please enter a number: 3.4
Please enter a number: 3,4
Error. Please re-enter the value.
Please enter a number: 3,4
Two errors in a row. Quitting...
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
