W WolfCode · CSC 141

List Basics

列表入门

≈ 15 min · python-lists python-loops · Open in WolfCode

The most important habit in Think Python ch.10: don't mutate your caller's list. Copy first.

The two functions

Python · runnable

Check yourself

Multiple right answers — but the t.append(t)... one is the trap.

Which of these returns [1, 2, 3, 99] AND leaves the caller's list intact?