Knowing about types of variables is very important in programming. You have to know how to differenciate between ‘3’ and 3, because if you mix types you have to be very careful or an error migh occur.

A simple way to find out what kind of type is something is to run the shell in python and set our variable if we have to.

Lets set:

x=3.7

y=’2′

z=2

f=’r’

and then lets write ‘type( )’ and in the parenthesis we’ll write the variable we want to find out about, like this:

show how to use type()
show how to use type()

Thats how we make sure to use the same kind or convert types in the right way.

CC BY 4.0 Basic types and their use in python by fersabal is licensed under a Creative Commons Attribution 4.0 International License.