Question: Rewrite the following program fixing all the errors and using try / except statements to handle all potential runtime errors. def try _ except _
Rewrite the following program fixing all the errors and using tryexcept statements to handle all potential runtime errors.
def tryexceptex:
numinputenter a value:"
numintinputEnter a value:"
divnumnum
printfnumnumdiv
If the errors is due to wrong value, set num and num for use in calculating div ans display "One of the values entered is not an integer, Setting values to and If the error is due to division by zero, set div toinfinity Use two tryexcept statements. The statement to display result should be outside of the tryexcept statements.
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
