01
Default argument evaluated once
What did reminders=[] do the second time the function ran?
A default is built once, when def runs, and it belongs to the function. Every later call without a list appends to that same one.
Source · Python docs · Default Argument Values
02
Assignment aliases, slicing copies
After b = a and b.append(4), what does a hold?
b = a binds a second name to the same list. a[:] builds a new one.
Source · Python docs · More on Lists
03
sort() returns None
You wrote names = names.sort(). What is in names now?
list.sort() orders the list in place and hands back nothing. sorted() leaves the original alone and returns the new list.
Source · Python docs · Sorting Techniques
04
is compares identity, == compares value
Two lists hold the same numbers. What does is say about them?
is asks whether the two names point at one object. == asks whether the two objects hold the same thing.
Source · Python docs · Comparisons
05
A tuple is immutable; the list inside it is not
You have t = (1, [2, 3]). Does t[1].append(4) raise?
The tuple fixes which objects it holds, not what those objects contain. The list inside it can still grow.
Source · Python docs · Tuples and Sequences