Question: # line 1 age = int(input(Enter your age: )) # line 3 print(Invalid input) If we want the computer to display Invalid input whenever a
# line 1 age = int(input("Enter your age: ")) # line 3 print("Invalid input") If we want the computer to display "Invalid input" whenever a floating point number such as 20.5 is entered by the user, what should be inserted in line 1 and line 3?
| A. | insert "try:" in line 1 and "except ValueError:" in line 3 | |
| B. | insert "try:" in line 1 and "except TypeError:" in line 3 | |
| C. | insert nothing in line 1 and "if age not in integer:" in line 3 | |
| D. | None of the above |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
