Python Validation and Error Handling
Check the Interval and Number of Readings
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 lower and upper endpoints when they are in increasing order. Return "Lower must be below upper" when they are reversed or equal.
A capture asks for 4 readings between 2 and 9. The lower endpoint must be below the upper endpoint, and the count must be a whole number from 1 through 20.
Inspect the component calculation
Check the capture interval( Lower and upper endpoints: Capture interval Endpoint order: increasing )
Examples and results
- Capture interval
- lower
- 2
- upper
- 9
- Required result
- lower
- 2
- upper
- 9
- Capture interval
- lower
- -2
- upper
- 5
- Required result
- lower
- -2
- upper
- 5
- Capture interval
- lower
- 0
- upper
- 1
- Required result
- lower
- 0
- upper
- 1
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
This workshop checks the interval and count only. Real Pydantic, nested fields and strict Python numeric types are tested in the coding challenges. 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.
A Boolean Arrives as the Count
This check uses the pieces from “Check the Two Requirements”.
BOTIE
- Capture interval
- lower
- -5
- upper
- 5
- Requested number of readings
true
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 the count pass while the complete capture still fails?
A request must meet every requirement that applies to it.
This workshop checks the interval and count only. Real Pydantic, nested fields and strict Python numeric types are tested in the coding challenges.