promptdojo_

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']

full-screen editor opens — close anytime to keep reading.