Today we’ll be looking at data types in Python. Python is an object-oriented language and doesn’t actually require a type declaration when creating variables. Nevertheless, variables will come under a few categories.
- Numeric
- Boolean
- Sequence
- Dictionary
Numerics include integers, floats and complex numbers:

Booleans are true or false, as we’ve seen in other languages:

Sequences include strings, lists and tuples:

And a dictionary is an unordered collection of data in a format:

When coding in Python, you may have noticed that there are no curly braces, this is because the compiler is looking at your indentation to define blocks of code. Using tabs will cause an indentation which can be used to define blocks and sub-blocks of code.
Now we’ll look at conditionals and loops. Conditionals in Python are a bit different to other languages, you have IF, ELSE and ELIF (which is the equivalent of ELSE IF):

Python also implements logical AND and OR by using keywords:


There are several types of loops available in Python, those being:
- While loop
- For in loop
- Index iteration loop



The last thing we’ll be taking a look at is functions in Python. These can be declared using “def”:

This function takes two arguments and adds them together. Note how in the functions, loops and conditionals we’ve looked at, there is a colon after before the indentation begins.
Next time
Next time we will be looking at NumPy arrays and Pandas dataframes.