runtime
406 / 500
question 406 NumPy Foundations · medium

Cold, windy days: the ambiguous truth value

cold_windy_days should return the positions of days that were at or below max_temp and had an average wind of at least min_wind. Every call crashes with ValueError: The truth value of an array with more than one element is ambiguous. Fix it.

Functioncold_windy_days(tmax, wind, max_temp, min_wind)
tmax, windlists of the same length, one value per day
Returnsa list of day positions (0 is the first day) where both conditions hold
Examples
callcold_windy_days([-0.5, 9.4, -12.1, -14.3], [2.8, 1.7, 7.8, 4.7], 0, 4)returns[2, 3]
callcold_windy_days([5, -8.8], [6.3, 6.3], -5, 5)returns[1]
callcold_windy_days([20, 21.1], [2, 9], 0, 4)returns[]

Loading your progress…

Cold, windy days: the ambiguous truth value — Python practice · Runtime