Data Structures

Pointers

Lesson

We saw that behind the scenes, Arrays don't store raw data inside of them - instead, they store pointers to their data. It turns out that every data structure stores pointers to their data. Everything's made up of pointers! Even variables are pointers in Python!

The amazing result of this is that whenever you write A = B, Python points A to B. There are no exceptions. Here's an example where we run one line of code at a time, and we show you the picture you should have in mind as the code runs.

Note that as the code ran, we changed y, but x changed too! This is confusing behavior to beginners, but it's easy to understand once you know everything's made of pointers in Python, and A = B always points A to B.

Mark as Completed:
Submits:
test
Test your code to get an output here!