Python and NumPy
Prepare the greenhouse target sheet
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
Choose a tool to create a rectangular sheet using the supplied day count, greenhouse count, and target. Then subtract the supplied readings from those targets to find how much warmer each position would need to become.
Botie needs a target temperature at each day and greenhouse position before measuring the shortfall from that target.
Build the filled grid from the supplied day count, greenhouse count and target, then subtract the observed grid.
Examples and results
- Number of days
2
- Number of greenhouses
3
- Target temperature
20
- Recorded temperatures
12 18 24 14 22 36 - Required result
8 2 -4 6 -2 -16
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
The workshop uses small positive dimensions. It does not expose uninitialised storage. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.
A single morning across four houses
This check uses the pieces from “Create a target sheet that fits the report”.
BOTIE
- Number of days
1
- Number of greenhouses
4
- Target temperature
19
- Recorded temperatures
19 21 16 20
Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. 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 do shape and a target's numeric value both belong in the creation step's contract?
Construct reference arrays from the required dimensions and values before applying elementwise comparisons.
The workshop uses small positive dimensions. It does not expose uninitialised storage.
Work through the Python challenges →