Question: In this exercise, you ll modify the Future Value program so the user can t cause the program to crash by entering an invalid int
In this exercise, youll modify the Future Value program so the user cant cause the program to crash by entering an invalid int or float value. In IDLE, open the futurevalue.py file thats in this folder: pythonexercisesch
Review the code and study the getnumber and getinteger functions. Note that they receive three arguments: the prompt for a user entry, the low value that the entry must be greater than, and the high value that the entry must be less than or equal to Then, review the calling statements in the main function and note how these functions are used.
Test the program. Note that you can cause the program to crash by entering values that cant be converted to float and int values.
Add exception handling to the getnumber and getinteger functions so the user has to enter valid float and int values. Then, test these changes to make sure the exception handling and the data validation work correctly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
