Lists are very similar to arrays. They can contain any type of variable, and they can contain as many variables as you wish. Lists can also be iterated over in a very simple manner. Here is an example of how to build a list.
Python (3.8.1)
-
Input
Accessing an index which does not exist generates an exception (an error).
Python (3.8.1)
-
Input
You will see an error message: IndexError: list index out of range
.