Python and NumPy

Prepare the greenhouse target sheet

BOTIE

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.
Ready to test
0 passed · 0 failed · 1 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

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
121824
142236
Required result
82-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

Create the target table for one morning and four greenhouses. Predict the target-minus-reading table, retaining its row dimension.
Number of days
1
Number of greenhouses
4
Target temperature
19
Recorded temperatures
19211620

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 →
Continue the courseChoose the Readings Without Losing Their Place →
← Which Direction Are We Adding?