Kodewick
Start learning →
Basic←→0 / 100

Cold nights

#053BasicListsLoops3 min

The balcony flowers do not like the cold. The list holds each night's temperature. Write cold_nights(temps, limit) to return how many nights were below limit (exactly equal does not count).

Examples
cold_nights([3, -1, 5, -4, 0], 0)→2
cold_nights([8, 9, 10], 5)→0
main.py
def cold_nights(temps, limit):
    count = 0
    for t in temps:
        # your code here: below limit adds 1 to count
        pass
    return count
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.