Skip to content

Oct 30: Immutability, Aliasing

Meet in EnGeo 2208

Learning Objectives

After today's class, you should be able to:

  • Explain why a string method returns a new string.
  • Contrast strings with lists, which can be changed in place.
  • Predict what happens to a list modified inside a function.

Lesson Outline

Presentation [10 min]

Mini Lecture [25 min]

  • Python Tutor
    • Passing strings and lists to functions
    • Objects (boxes) + references (arrows)

Q4–Q6 [15 min]

  1. Building with a loop
  2. Counting with a dict
  3. Reasoning about pytest

Your To-Do List

  • Required before Monday's class:
  • Have a safe and Happy Halloween! 🎃 👻