Python float() Function

❮ Built-in Functions


Example

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

More Examples

Example

Convert a string into a floating point number:

x = float("3.500")
Try it Yourself »

❮ Built-in Functions

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.