Python and NumPy

Find the greenhouse alerts

BOTIE

Build a mask using the threshold, then use it to select the original readings. Preserve their order and allow an empty result.
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

Build a mask using the threshold, then use it to select the original readings. Preserve their order and allow an empty result.

Botie wants the original temperatures that meet an alert rule. The yes-or-no comparisons are only an intermediate result.

Compare readings with the inclusive limit, then use the resulting mask to select entries from the original readings.

Examples and results
Greenhouse temperatures
  1. 020
  2. 127
  3. 225
  4. 318
Alert temperature
25
Required result
  1. 027
  2. 125
Greenhouse temperatures
  1. 023
  2. 120
  3. 224
  4. 322
Alert temperature
22
Required result
  1. 023
  2. 124
  3. 222
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 limit is supplied by the task. It is not a learned or medically meaningful threshold. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Two houses exactly at the alert limit

This check uses the pieces from “Use decisions to select measurements”.

BOTIE

Two greenhouse readings equal the alert temperature. Predict the selected readings under the inclusive alert rule, retaining their order and repetitions.
Greenhouse temperatures
  1. 024
  2. 125
  3. 225
  4. 327
Alert temperature
25

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 the mask and the selected temperatures need separate wires, and why does equality with the limit count here?

A Boolean decision array can select aligned values; an empty selection should remain valid when nothing matches.

The limit is supplied by the task. It is not a learned or medically meaningful threshold.

Work through the Python challenges →
Continue the courseSummarise a Report Without Losing the Question →
← One Reference for Many Rows