1 September 2026
Safe Temperatures
Easy
Lists
Numbers
Keep the readings that are inside a chosen safe range.
You are given greenhouse temperature readings, plus a lowest safe temperature and a highest safe temperature. Look at each reading in order. Keep it when it is at least the lowest safe temperature and at most the highest safe temperature. Return the kept readings in the same order. The two safe limits are included. Return an empty list when no reading is safe.
Constraints
readings contains at most 100 whole numberslowest_safe is less than or equal to highest_safeEvery reading is a whole number
Function signature
def safe_temperatures(readings, lowest_safe, highest_safe):