Shallow copy, deep copy, and the nested-dict bug — step 8 of 9
Write a function clone_user that takes a user dict and returns a fully
independent copy — meaning if the caller mutates the cloned user's
roles list, the original user's roles list does not change.
The copy module is already imported. Two prints at the bottom check the
result. Expected output:
original roles: ['member']
cloned roles: ['member', 'admin']
⌘↵ runs the editor.read, then continue.
Write a function clone_user that takes a user dict and returns a fully
independent copy — meaning if the caller mutates the cloned user's
roles list, the original user's roles list does not change.
The copy module is already imported. Two prints at the bottom check the
result. Expected output:
original roles: ['member']
cloned roles: ['member', 'admin']
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.