Javatpoint Logo
Javatpoint Logo

Python float() Function

The python float() function returns a floating point number from a number or string.

Signature

Parameters

value- It can be a number or string that converts into a floating point number.

Return

It returns a floating point number.

Python float() Function Example 1

The below example shows the working of float():

Output:

8.0
7.19
-24.17
-17.15
ValueError: could not convert string to float: 'xyz'

Explanation: In the above example, a number and a string value is being converted into a floating point number.


Next TopicPython Functions




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA