Skip to main content
  1. /classes/
  2. Classes, Spring 2025/
  3. CS 2370 Spring 2025: Course Site/

cs2370 Notes: 14 Mutation

·48 words·1 min·

Design:

  • Add one to each item in a list.
  • Add one to each item in a list, in place.
    • for ii in range(len(xs)):

Distraction:

  • Let’s make a grid of colored cells.

Concepts:

  • Mutation
  • Mutability
    • List are, tuples aren’t.
  • Pass by value vs. reference
    • Unexpected mutation
  • Nested mutation
  • Reassignment
Nat Tuck
Author
Nat Tuck