Type Conversion: Repentance of Data Types

In [62]:
# Convert float to int
print(type(10200.58))
print(type(int(10200.58)))
<class 'float'>
<class 'int'>
In [63]:
# Convert string to int. String must be integer string
print(type('5'))
print(type(int('5')))
<class 'str'>
<class 'int'>
In [65]:
# Convert int to bool
print(type(1))
print(type(bool(1)))
<class 'int'>
<class 'bool'>