mutation — why your code mysteriously breaks7 / 8
mutation and the action-at-a-distance bug
Claude wrote a function that's supposed to give back a new list with the
scores doubled, leaving the original alone. Instead, it mutates the input —
after the call, both original and doubled are the same doubled list.
Fix line 2 so the function works on a copy and the original list stays as
[10, 20, 30].
Expected output:
original: [10, 20, 30]
doubled: [20, 40, 60]
The break is on line 2 — but read the whole snippet first.
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _