promptdojo_

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.

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