Mutation and the action-at-a-distance bug — step 7 of 8
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.read, then continue.
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.
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.