Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python float() function is used to return floating point number. float() takes a number or string (which can be converted into number) as input parameter and return floating point number.

Syntax

float(value)

Parameters

value Required. A number or string which can be converted into number.

Example:

In the below example, float() function is used to return floating point number.

MyNumber = 10
print(float(MyNumber))

MyNumber = 10.555
print(float(MyNumber))

MyString = "50.555"
print(float(MyString))

The output of the above code will be:

10.0
10.555
50.555

❮ Python Built-in Functions