- All Courses
- Python Foundations for Data Work
- Python Essentials
- Values, types, and variables
Lesson 1.1Free preview
Values, types, and variables
A Python variable is a name bound to an object, not a box holding a value.
14mBeginner31.1k students
Overview
Names point at objects
A Python variable is a name bound to an object, not a box holding a value. Assigning one name to another binds both to the same object, which is invisible for numbers and strings and very visible for lists.
That distinction is the source of the classic beginner surprise: appending to a list through one name changes what the other name sees, because there was only ever one list.
Immutable types — numbers, strings, tuples — sidestep the problem entirely. Any operation that looks like a change produces a new object instead.
In this lesson you will:
- Tell the built-in types apart
- Understand names as references to objects
- Recognise mutability and why it matters
Resources
Notes are not saved yet — they clear when you leave this page.
Control flow and comprehensions
10m