The print function
11. Integers, strings, and floats
Math in Python
The input function


Okay! Just like there are various types of cells in Excel (numbers, dates, text...), there are also various types of variables in Python. For instance:

  • Integers (int):

    current_age = 5
  • Floating-point numbers (the type is called float in Python) – numbers with decimal fractions that use dots (.):

    current_weight = 75.5
  • Strings (string) – text values surrounded by single quotes (' ') or double quotes(" "):

    standard_greeting = 'My name is Tom!'

Unlike many other programming languages, Python automatically detects the type of variable it should use. For instance, if you type:

temperature = 36.6

Python will know that the temperature variable is a float because the number contains a dot.


In Python, there is a function named type() that can tell you the type of the variable inside its parentheses. Now, take a look at the template code and run it.

You can see that var1 is an integer (int); var2 is a float because it contains a decimal point (.); and var3 is a string (str) because it is put inside quotes.

Stuck? Here's a hint!

Simply run the template code.