Freezer alarm

A cold store keeps frozen food at -18 °C. A sensor in each freezer sends a temperature reading in degrees Celsius every minute. When the sensor fails to measure, it sends None instead of a number. The function freezer_status must return:

  • "No reading" when the reading is None;
  • "Alarm" when the reading is above -15.0 °C;
  • "OK" otherwise.

Listing 1 shows the implementation that a programmer submitted.

Listing 1: A function that classifies one freezer reading (Question 1).
def freezer_status(reading: float | None) -> str:
    if not reading:
        return "No reading"
    if reading > -15.0:
        return "Alarm"
    return "OK"

A technician runs each of the following checks on its own. Which check fails?

  1. assert freezer_status(None) == "No reading"
  2. assert freezer_status(-18.0) == "OK"
  3. assert freezer_status(0.0) == "Alarm"
  4. assert freezer_status(-15.0) == "OK"