Help with dictionaries and frequency tables 7/15

I need help with this lesson
This is what I have so far-

Hello @ldsouza_1978! Okay. We can solve this. :smiley:

You have a dictionary with all possible content_ratings and the count of each rating has been initialized to 0. Now we go through each row of apps_data and from that row we extract the rating: c_rating.

Then we check if that rating actually exists in the dictionary of ratings we initialized. Now, the question is: what do we want to do we to do if the rating exists

The answer? Update the count of that rating in the content_ratings.

So, what you want to do is this: content_ratings[c_rating] = content_ratings[c_rating] + 1 or content_ratings[c_rating] += 1.

This line of code will take the count that was stored in the dictionary for that particular rating and add 1 to it.

Does that make sense?

1 Like

It worked! Thanks so much!!

1 Like

@ldsouza_1978 You are very welcome! :smiley: Do you mind marking the answer as the solution? This will show that this question has been solved and help anyone having the same problem.
How to that? Easy!
Just click on the 3 dots ... next to Reply right under my answer and then click on the square box with the check mark in it. Thank you very much. :pray:

2 Likes

Hey @ldsouza_1978!

Great question - glad our awesome moderator @Yemi could help out. Next time you ask a question, please be sure to copy/paste the code you’ve tried, the output, and any other relevant information we see in this picture - instead of the picture itself!

This will help us get you an answer even faster since we’ll be able to copy/paste your code and try to reproduce. Looking forward to more amazing contributions from you!

Mary

3 Likes