Question: When we read values using the input command, they always start as strings If we try to convert a string to an integer or a


When we read values using the input command, they always start as strings If we try to convert a string to an integer or a float and the conversion fails, anerrol be thrown. Specifically, a value error. We can catch this error using an except statement. The following example shows an error being caught. try: x-int("Not a Number") except ValueError as print("Error:",e) If the code is executed, it will print Error: invalid literal for int) with base 10: 'Not a Number" For this part of the lab, ask the user for an input and use try/except statements to determine if the data is an integer, float, or string. The interface should match the following examples Welcome to Type Guesser Enter Something: You entered an integer! Value: Welcome to Type Guesser Enter Something: 12.9 You entered a float! Value: 12.9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
