Python float() Function

Converts a string or integer to a floating point number.

Syntax

Python
float(item)

Parameters

ParameterDescription
item Required. The string or number to be converted to a floating point value

Example

Python
print(float(1))
print(float('3.14'))

Output

1.0
3.14