Python Tutorial Python Advanced Python Resources Python Libraries
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

Python float() Function



The Python float() function returns 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 example below, float() function returns 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

5