F
F
frokwY2020-06-24 10:56:57
Python
frokwY, 2020-06-24 10:56:57

I do not understand what is the problem, how to write correctly?

Totally confused, please help
5ef30732c71b7371806659.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drill, 2020-06-24
@Drill

The function must return the result of count

def comfort_count(temperatures):
    count = 0
    for temp in temperatures:
        if 22 <= temp <= 26:
            count += 1
    returtn count

print(comfort_count(may_2017))

Or like this:
def comfort_count(temperatures):
    return sum(1 for temp in temperatures  if 22 <= temp <= 26)

or even like this:
def comfort_count(temperatures):
    return sum(22 <= temp <= 26 for temp in temperatures)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question