Checking your account

You can read the lesson while its saved answers and constructions load. Learning controls will open once that work is ready.

Python Testing and Project Tools

Replace the sensor input

Coding challenges

BOTIE

Look up source_name in sources, then filter those records using temperature_c and limit_c. With recording selected and a limit of 25, return the complete south record. Changing the source must change the result without changing the alert rule.
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

Look up source_name in sources, then filter those records using temperature_c and limit_c. With recording selected and a limit of 25, return the complete south record. Changing the source must change the result without changing the alert rule.

The sensor is unavailable, but the report still needs a repeatable input.

Look up one name retrieves the records under source_name. Read temperature_c, check the alert limit, and keep the matching original records.

Examples and results
Recorded and device readings
recording
  1. house
    north
    temperature_c
    18
  2. house
    south
    temperature_c
    25
device
  1. house
    north
    temperature_c
    30
  2. house
    south
    temperature_c
    19
Alert limit in C
25
Source name to use
recording
Required result
  1. house
    south
    temperature_c
    25
Recorded and device readings
recording
  1. house
    north
    temperature_c
    18
  2. house
    south
    temperature_c
    25
device
  1. house
    south
    temperature_c
    29
  2. house
    north
    temperature_c
    31
Alert limit in C
30
Source name to use
device
Required result
  1. house
    north
    temperature_c
    31
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

Both sources are supplied local records. The blocks do not contact a sensor. The Python collector also handles calibration, per-record limits and a complete report payload. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

A replacement source has no alerts

This check uses the pieces from “Build with the recorded input”.

BOTIE

The selected recording contains north at 20 C and south at 24 C. The unused device still contains a north reading at 40 C. The shared alert limit stays at 25 C.
Recorded and device readings
recording
  1. house
    north
    temperature_c
    20
  2. house
    south
    temperature_c
    24
device
  1. house
    north
    temperature_c
    40
Alert limit in C
25
Source name to use
recording
Should the unused device reading at 40 C appear in this result?

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.

What would still need checking against the actual sensor?

Replace the input source without copying the report calculation.

Both sources are supplied local records. The blocks do not contact a sensor. The Python collector also handles calibration, per-record limits and a complete report payload.

Continue the courseModules and Project Structure →
← Testing Python Functions