Check the type

Report a typo

Below, you can see a small piece of code. The user should input a value and, if it cannot be transformed into a float, the ValueError should be raised. Fix one line of the code to achieve this. Enter the fixed line in the text field below.

try:
    number = input("Enter a float: ")
except ValueError:
    print("Your input is not a float!")
Enter a short text
___

Create a free account to access the full topic