THE WORLD'S LARGEST WEB DEVELOPER SITE

Python float() Function

❮ Built-in Functions


Example

Convert the number 3 into a floating point number:

x = float(3)
Run example »

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

More Examples

Example

Convert a string into a floating point number:

x = float("3.500")
Run example »

❮ Built-in Functions