I want to check whether my answer is right or not

I have already checked the answer from ( see the answer ), but when I print(the_table)) :
this is the output :
{‘0-1000000’: 7197,
‘1000000-1500000’: 0,
‘1500000-2000000’: 0,
‘2000000-2500000’: 0,
‘2500000-3000000’: 0}

Why?
The mission link: https://app.dataquest.io/m/314/dictionaries-and-frequency-tables/13/filtering-for-the-intervals

Your if clauses are checking against counts. But what is counts?
This might help.

1 Like

I am sorry, but I don’t understand you.
counts is the number of users’ ratings.

Your code

for row in apps_data[1:]:
     if counts > values:
          conditions..

So you what is the value of count you want to use in each iteration?

Should count be row[5]?

1 Like

Yes, I have already written ( counts = float( row[5] ) ) in my code.

Yes, you did, in the first for loop.

You should check this,

1 Like

I have read it, but I also don’t understand.

Since you are using the same variable, counts in the second loop will have certain value assigned to it from the previous loop, that of the last iteration.
We want counts to be starting from the first row in the second loop, we need to explicitly define it.
So if you add counts=float(row[5]) again inside the 2nd for loop, you will get the results.

1 Like

Thanks a lot for the clarification.

1 Like