#Use the float() Function

print(float(7))
print(float("10.6"))

The float() function is used to convert a given value into a floating-point number (a number with a decimal point) of type float.

The function can also be called without any argument in which case it returns 0.0

float(x = None)
x The value to be casted to a floating type value. It is optional

The function returns the floating point representation of .If x is not given it returns 0.0

Examples:

float()
//0.0
float(2.2)
//2.2
float(0)
//0.0
float(5)
//5.0
float("8.5")
//8.5
float("100.00")
//100.0

Passing a value which is not representable as a float raises a ValueError. The value passed also needs to be of  supported type, such as integer, string or  a user defined object that defines the __float__ method, otherwise a TypeError is raised. Examples:

float("100.0.0")
//ValueError: could not convert string to float: '100.0.0'
float("Hello")
//ValueError: could not convert string to float: 'Hello'
float([1, 2])
//TypeError: float() argument must be a string or a real number, not 'list'
float({2})
//TypeError: float() argument must be a string or a real number, not 'set'