| title | Python float() built-in function - Python Cheatsheet |
|---|---|
| description | Return a floating point number constructed from a number or string x. |
The float() function in Python is a built-in function that allows you to convert a number or a string containing a number into a floating-point number. This is particularly useful when you need to perform arithmetic operations that require decimal precision.
The float() function returns a floating point number from a number or a string.
float('10')
float(10)10.0
10.0
- int()
- complex()
- Python Data Types
- str()
- round()
- String Formatting