Built-in Functions
float()
Convert a value to a decimal number.
float(number=0.0)
float() creates a number that can hold a decimal point. It can convert suitable numbers and numeric strings.
Parameters
| Name | Description |
|---|---|
| number | A number or numeric string to convert. If omitted, it defaults to 0.0. |
Returns
A floating-point number.
Try it
Run it and change it
text = "3.5" number = float(text) print(number + 0.5)