# Python float() Function

In this guide, we are going to learn all about the python float() function to convert any number to a float number.
Using the python float method you can convert any integer as well as any string number to a floating pointing number.

In the previous python built-in functions tutorial, we have seen lots of functions along with their examples.

Contents

## Python float() Function

Python float function is a built-in function that is used to convert any specified value into a floating pointing number.

## Syntax

The syntax of float function in python is:-

``float(value)``

## Parameter

float() function take single parameter.

• value:- A number or a string that can be converted into a floating point number.

## Return Value

Return value of float function in python is always a float number.

## Python float example

Here we will use the python float function to convert numbers to a floating-point numbers.

### Example 1:

Convert integer to floating point.

``````a = 12
x = float(a)
print(x)``````

Output will be:- 12.0

### Example 2:

Convert string number to floating point number.

``````b = '12.88'
y = float(b)
print(y)``````

Output will be:- 12.88

### Example 3:

Convert list of numbers into float number.

``````num = [12, 20, 12, '12', 60, 78, '60.5']
for i in num:
print(float(i))``````

Output

``````12.0
20.0
12.0
12.0
60.0
78.0
60.5``````

## Conclusion

In this tutorial, you have learned all about the python float method to convert any number entered by users to floating-point numbers. Using the float function in python, you can convert any string number to a floating-point number as well.

If this article helped you, please keep visiting for further python built-in functions tutorials.

Other Python built-in functions