bugger.
All challenges/Pythoneasyquick-state-copy-v1
THE INVESTIGATION

Copy before appending

Given an array, append 1 to a copy and return an object with original and copy arrays. The original must remain unchanged.

State

What’s going wrong

Original short debugging exercise. Given an array, append 1 to a copy and return an object with original and copy arrays. The original must remain unchanged. Read one JSON array from standard input and print the result as JSON. Repair the function and run the checks.

Expected behavior

Given an array, append 1 to a copy and return an object with original and copy arrays. The original must remain unchanged.

Reproduction

01 Reproduction
[2]
{"original": [2], "copy": [2, 1]}
02 Control
[]
{"original": [], "copy": [1]}

Before you begin

  • Basic Python expressions

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.