Mutation and the action-at-a-distance bug — step 8 of 8
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
One last thing. AI wrote a function tag_user that's supposed to return a
new user dict with one extra tag, leaving the original user alone. Right
now it mutates the input.
Finish the function so the script prints two lines: the original user
unchanged, and the new user with "vip" added to its tags.
Expected output:
original tags: ['pm']
tagged tags: ['pm', 'vip']
One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.
One last thing. AI wrote a function tag_user that's supposed to return a
new user dict with one extra tag, leaving the original user alone. Right
now it mutates the input.
Finish the function so the script prints two lines: the original user
unchanged, and the new user with "vip" added to its tags.
Expected output:
original tags: ['pm']
tagged tags: ['pm', 'vip']
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.