Checking your account

You can read the lesson while its saved answers and constructions load. Learning controls will open once that work is ready.

Python Validation and Error Handling

Add a Draft Tag without Changing the Original

Coding challenges

BOTIE

Return the original and draft records before editing either one. Both should still contain the current original tags.
Ready to test
0 passed · 0 failed · 2 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Return the original and draft records before editing either one. Both should still contain the current original tags.

The north report has tags ["raw"]. A reviewed draft needs ["raw", "checked"], while the original must still have ["raw"]. Copying the outer record alone can leave both reports sharing one tag list.

Inspect the component calculation
Copy the report(
  Original report: Original report
  Copy: nested values too
)
Examples and results
Original report
house
north
tags
  1. 0raw
Required result
original
house
north
tags
  1. 0raw
draft
house
north
tags
  1. 0raw
Original report
house
west
tags
[]
Required result
original
house
west
tags
[]
draft
house
west
tags
[]
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

Sharing is demonstrated inside a private copy of the example. The actual input stays unchanged. Python exercises check real object ownership and deep copies. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Your last tested pieces can start the full construction. An existing draft there keeps its own pieces.

Review a Report with More Existing Tags

This check uses the pieces from “Make the Draft Independent”.

BOTIE

The east report already has ["raw", "night", "urgent"]. Its draft receives the new tag "ready". Keep the original report available for comparison.
Original report
house
east
tags
  1. 0raw
  2. 1night
  3. 2urgent
Tag for the draft
ready

Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

Why can two separate records still show the same unexpected edit?

Check what a copy shares before changing a nested value.

Sharing is demonstrated inside a private copy of the example. The actual input stays unchanged. Python exercises check real object ownership and deep copies.

Continue the courseContext Managers and Resource Cleanup →
← Python Exceptions