Convert value to a decimal number. Text must contain a valid number; True becomes 1.0 and False becomes 0.0.
Syntax
float(value=0.0, /)Parameters
| Name | Description |
|---|---|
valueInt | Float | Boolean | String | Value to cast Optional · Positional only Default: 0.0 |
Returns
Float — Converted floating-point value.Example
score = float("0.85")
if score > 0.8:
text("ok")