Python float() Function
Description
float() The function is used to convert integers and strings into floating-point numbers.
Syntax
float() Method Syntax:
class float([x])
Parameters
- x -- an integer or string
Return Value
Returns a floating-point number.
Example
The following examples show the use of float():
float
(
1
)
1.0
float
(
112
)
112.0
float
(
123.6
)
123.6
float
(
'
123
'
)
String
123.0
Python built-in function