Skip to main content

3.8) Changing Types


You can change the type of data using the float() and int() functions.

For example, to change an integer into a float. Type:

>>> print float(3)
3.0

And to change a float into an integer:

>>> print int(3.1)
3

Try it yourself with different numbers.