CPSC 203, 2026 W1
September 22, 2026
Lab 2 and POTW 2 now available.
Practice examlet 1 now available.
Treat “Problems of the Week” as “Problems of the Day”: Spend 15 minutes to do a little programming each day.
We will be using marimo for our more involved Python coding exercises.
Open the List Activity on PrairieLearn and choose the List Mysteries question.
Let’s explore some surprising list behaviors.
Inside the workspace there are other files, each containing a short sequence of exercises. Complete them, and then we’ll review together.
Be curious. Feel free to experiment by changing things!
Write down surprising behaviors.
Lists are ordered collections that can hold any type of data.
We can:
provinces[0]numbers[1:3]len(provinces)What about provinces.append(['Ontario', 'Quebec'])?
Assignment doesn’t copy lists!
copy() only copies the outer list. The inner lists are still shared!
Use deepcopy() when you have nested structures (lists of lists, lists of objects).
Variables are names that refer to objects in memory.
Think of it like sticky notes on boxes - m1 and m2 are two sticky notes on the same box.
A compact way to create lists:
Both produce: [0, 1, 4, 9, 16]
Notice the difference: if at the end filters, if/else before for transforms.