Act fast, special offers end soon! Up to \$294 is savings when you get Premium today.

# 13. Filttering for the Intervals

My Code:

``````n_rating_count = []
for row in apps_data[1:]:
rating = int(row[5])
n_rating_count.append(rating)

ratings_max = max(n_rating_count)
ratings_min = min(n_rating_count)

user_ratings_freq = {'0 - 600000': 0,'600000 - 1200000': 0,'1200000 - 1800000': 0,'1800000 - 2400000': 0,'240000000 +': 0}

for row in apps_data[1:]:
user_ratings = int(row[5])

if user_ratings <= 600000:
user_ratings_freq['0 - 600000'] += 1

elif 600000 < user_ratings <= 1200000:
user_ratings_freq['600000 - 1200000'] += 1

elif 1200000 < user_ratings <= 1800000:
user_ratings_freq['1200000 - 1800000'] += 1

elif 1800000 < user_ratings <= 2400000:
user_ratings_freq['1800000 - 2400000'] += 1

elif user_ratings > 240000000:
user_ratings_freq['240000000 +'] += 1

print(ratings_max)
print(ratings_min)
print(user_ratings_freq)
``````

What I expected to happen:
2974676 ← Max
0 <–Min
{‘0 - 600000’: 7181, ‘600000 - 1200000’: 12, ‘1200000 - 1800000’: 1, ‘1800000 - 2400000’: 2, ‘240000000 +’: 0}

I believe my frequency is wrong. It is not possible to get ‘0’ at the last frequency label.

I’ve re-writed my code following the answer, but still getting this odd result. Cannot find where is the mistake here.

What actually happened:
2974676
0
{‘0 - 600000’: 7181, ‘600000 - 1200000’: 12, ‘1200000 - 1800000’: 1, ‘1800000 - 2400000’: 2, ‘240000000 +’: 0}

``````Replace this line with the output/error
``````

Hi @leosmoura: kindly follow the boundaries as set here. You will need to modify your code accordingly.