Mutability and aliasing

14-minute lesson · module-lists-02

You are previewing this course as a guest

Read anything and run any exercise you like. It all runs in your own browser, so nothing here is saved: no XP, no progress, and the AI tutor needs an account. Sign in and your work starts counting.

Sign in

Mutability and aliasing

14-minute lesson · module-lists-02

  • Modify a list in place with index assignment.
  • Recognize when two names point at the same list (aliasing).
  • Make a real copy with slicing or `list()`.

Source attribution

Status: adapted

How to Think Like a Computer Scientist: Interactive Edition source · Lists / Objects and references / Aliasing / Cloning lists

Adaptation notes. Reading rewritten in our voice. Hidden tests authored specifically for PyTutor AI. CodeLens demo highlights aliasing visually.

License notes. Verify chapter-level license metadata on Runestone before copying any text verbatim. This lesson contains no verbatim quotations.