Question: ( a ) Describe briefly what an exception is , and explain the usage of the try, except and finally statements. ( b ) The
a Describe briefly what an exception is and explain the usage of the try, except and finally statements. b The following program asks the user for a temperature in degrees Fahrenheit, and prints the temperature in degrees Celsius instead. def fcx: return x s inputEnter a temperature in F: f floats printF is Cformatf fcf This program crashes if the user enters a string that cannot be converted to a float. Rewrite the program using try and except so that it repeatedly asks the user for a string, until a string that can be converted to a float is given, before printing the result.
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
