Python's variables aren't buckets that contain things. They're pointers that reference objects.
The way Python's variables work can often confuse folks new to Python, both new programmers and folks moving from other languages like C++ or Java.
Below are 9 minutes of screencasts explaining how Python's variables and values work. If you prefer reading over watching, you can find the transcript for each screencast below each video.
Talks I recommend on this subject:
Articles I recommend on this subject:
Hello friendly web visitor! 👋
This page is part of Python Morsels, an online Python skill-building service.
The best way to learn is by doing. In the case of Python that means writing Python code. If you'd like to improve your Python skills every week, try out Python Morsels by entering your email below to create an account.
Python Morsels topics pages are free and the first month's worth of exercises is free as well. You don't need to enter payment details to sign up.
You can find explanations of many other Python topics by signing up below.