Learn

Finally, the type() function returns the type of the data it receives as an argument. If you ask Python to do the following:

print type(42) print type(4.2) print type('spam')

Python will output:

<type 'int'> <type 'float'> <type 'str'>

Instructions

1.

Have Python print out the type of an int, a float, and a str string in the editor. You can pick any values on which to call type(), so long as they produce one of each.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?