Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started