runtime
408 / 500
question 408 NumPy Foundations · medium

Find impossible temperature readings

Before daily highs and lows go into a report, a check lists every day that can't be trusted: either reading is missing (None), the low is above the high, or either reading is outside −60 to 60 °C. Write invalid_days(tmax, tmin): return the positions of those days, in order, each once.

Functioninvalid_days(tmax, tmin)
tmax, tminlists of the same length; values are numbers or None
Returnsa list of positions (0 is the first day)
Rulesa low equal to the high is valid; −60 and 60 themselves are valid
Examples
callinvalid_days([6.7, None, 9.4, 75], [-4.9, -4.9, 12, 3])returns[1, 2, 3]
callinvalid_days([-0.5, 6.7], [-5.5, -4.9])returns[]
callinvalid_days([], [])returns[]

Loading your progress…

Find impossible temperature readings — Python practice · Runtime