Convert value to an integer, discarding the decimal part of numeric inputs. Text must contain an integer; decimal text raises an error. True becomes 1 and False becomes 0.
Syntax
int(value=0, /)Parameters
| Name | Description |
|---|---|
valueInt | Float | Boolean | String | Value to cast Optional · Positional only Default: 0 |
Returns
Int — Converted integer value.Example
threshold = int(3.9)
text(str(threshold))