input float python

# python code to take float input
val = float(input("Enter any number: "))
print("value of val2: ", val)
print("type of val2: ", type(val))

Here is what the above code is Doing:
1. We are taking input from the user and storing it in a variable called val.
2. We are printing the value of val.
3. We are printing the type of val.

As you can see, the input() function takes input from the user and stores it in a variable.

The type of the variable is automatically set to string.

If we want to take input in some other format, we need to typecast it.

In the above example, we have taken input in the form of a float.

If we want to take input in the form of an integer, we need to typecast it.