Python float() Function
Converts a string or integer to a floating point number.
Syntax
Python
Copy Code
float(item)
Parameters
Parameter | Description |
---|---|
item |
Required. The string or number to be converted to a floating point value |
Example
Python
Copy Code
print(float(1)) print(float('3.14'))
Output
1.0 3.14