7/34
Part 2 of 8 · CheckingLearn and do

Copy each row once, so the result shares nothing with the input

Each step returns a new table. Make sure it really is new.

table = [[21, 19, 23], [25, -40, 24]]
# what ("sort", 1) does
out = sorted(table, key=lambda row: row[1])
out[0][0] = 99
print(table)
Predict

out = sorted(table, ...), then out[0][0] = 99. Does the caller's table change?

Pick one to see what it prints.
Pick an answer above to see the rest