Python float() Function
ExampleGet your own Python Server
Convert the number 3 into a floating point number:
x =
float(3)
Try it Yourself »
Definition and Usage
The float()
function converts the specified
value into a floating point number.
Syntax
float(value)
Parameter Values
Parameter | Description |
---|---|
value | A number or a string that can be converted into a floating point number |