float()
function returns an expression(or value) converted into a floating-point number.
float(number)
Here,
Note: Float accepts the strings nan, inf, and -inf for NaN and positive or negative infinity. The case and a leading + are ignored as well as a leading - is ignored for NaN. Float always represents NaN and infinity as nan, inf, or -inf.
>>> float(1)
1.0
>>> float(1.34)
1.34
>>> float('2')
2.0
>>> float('-2')
-2.0
>>> float('-2.313123')
-2.313123
>>> float('+nan')
nan
>>> float('-infinity')
-inf