← Data Structures

Arrays and Lists

Sometimes, we need to group data together.

When all our data is of the same type, we can use arrays:


An array of integers might look like: [5, 18, -9]

An array of strings might look like: [“23yo”, “woman”, “SOB”]

An array of booleans might be: [True, True, False]


If we want to combine data of different types, then we might use a list instead. For example: [5, “23yo”, True].

Then, to access a piece of data in our lists and/or arrays, we need to find its “index”.

An index is like a nametag for each datapoint.

The first datapoint has an index of 0, the second has an index of 1, the third has an index of 2, and so on.

And if you'd prefer a more intuitive naming system, you'll like dictionaries.