A thermometer is calibrated for temperatures between -50 and 60 degrees Celsius. Blank cells, error codes, and out-of-range readings should be skipped. Valid zeroes matter.
A wind gauge can give a number even when that number is impossible for the instrument.
raw = " -1.5 "
speed = float(raw)
if speed < 0:
print("Check the gauge") # printed for this reading
else:
print(speed)Conversion and range checking answer separate questions. The temperature cleaner must handle failures of both kinds.
Implement clean_temperature(cell). Return a float if the text is numeric and the value lies between -50 and 60 inclusive. Return None otherwise. Accept surrounding spaces.
clean_temperature(" -2.5 ") # -2.5
clean_temperature("ERR") # None