Python Validation and Error Handling
Check a Note and Default the Copy Count
BOTIE
Examples, experiments and workspace controls
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.
Context for this challenge
Return the original request when its note is text or null. Return "note is missing" when the key is absent.
A report request must include note, even when the sender chooses null, meaning no note. If copies is absent, use 1. The supplied titles are already valid text.
Inspect the component calculation
Check one request field( Request: Report request Field: note Presence: required Allowed value: text or null )
Examples and results
- Report request
- title
- Inspection notes
- note
- null
- Required result
- title
- Inspection notes
- note
- null
- Report request
- title
- Morning report
- note
- Check page two
- copies
- 3
- Required result
- title
- Morning report
- note
- Check page two
- copies
- 3
- Report request
- title
- Draft report
- note
- ""
- copies
- 0
- Required result
- title
- Draft report
- note
- ""
- copies
- 0
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
These pieces demonstrate selected field rules. They do not run Pydantic. JSON null represents Python None; the Python challenges check the full model. 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.
The Note Contains a Number
This check uses the pieces from “Keep Missing and Null Different”.
BOTIE
- Report request
- title
- Evening report
- note
- 17
- copies
- 2
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.
Which setting allows a supplied null without permitting an absent note?
Declare requiredness separately from the allowed values.
These pieces demonstrate selected field rules. They do not run Pydantic. JSON null represents Python None; the Python challenges check the full model.