int() / float() / str()
function
Convert values between types. Raises ValueError if conversion is not possible.
Syntax
int(x) float(x) str(x)
Example
python
int('42') # 42
int(3.9) # 3 (truncates)
float('3.14') # 3.14
float(42) # 42.0
str(42) # '42'
str(3.14) # '3.14'
bool(0) # False
bool('') # False
bool('hello') # True