Copying

There are two kinds of copy.

A shallow copy makes a new outer container, but the items inside are the same objects. xs[:], list(xs), xs.copy(), dict(d) and copy.copy(x) are all shallow. That's enough when the items are immutable, like numbers or strings.

A deep copy with copy.deepcopy(x) copies everything, all the way down. You need it when the items are themselves mutable, like a dict holding lists, and you want to change the inner parts without touching the original.

Deep copies are slower and use more memory, so don't use them by default. In interviews, the usual case is backtracking: when you save a partial answer, copy it (path[:]), or later changes will overwrite what you saved.

Run it and compare shallow and deep after the original changes. Then try team.copy() in place of copy.copy(team).