A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-161.py
1classBox:
2items=[]
3a=Box();b=Box()
4a.items.append(1);b.items.append(2)
5print(a.items,b.items)
Classes
Answer & explanation
Console output
[1, 2] [1, 2]
Why
A class attribute is stored once on the class object. Reading a.items finds nothing on the instance, so it falls through to Box.items, the same list for every instance. .append mutates that single list in place (it never rebinds the name), so both instances see [1, 2].