Trouble with dictionaries and frequency table instructions

Hi guys, id appreciate some help understanding this section, I feel like my grasp of the for and in functions is weak, I can use them but I don’t truly understand what they’re doing in a way that I can manipulate them well, or maybe its a basic grasp of the syntax who knows.

Screen Link:

My Code:

content_ratings = {'4+': 4433, '12+': 1155, '9+': 987, '17+': 622}
total_number_of_apps = 7197

c_ratings_percentages = {}
c_ratings_proportions = {}

for key in content_ratings:
     proportion[key] = [key] / total_number_of_apps
     c_ratings_proportions [key] = proportion
     percentage = proportion * 100
     c_ratings_percentages[key] = percentage
print (c_ratings_proportions)

What I expected to happen:
What I meant to happen is that for each key in the content ratings, the proportion is equal to the value of that key divided by the number of apps, then the code should assign the proportion integer to the list using the ‘key’ as its key, then the second list just adds the proportion value * 100 as the percentage integer using the ‘key’ as its key.

The error get is:

TypeErrorTraceback (most recent call last)
<ipython-input-1-3e2b5967ee7d> in <module>()
      7 for key in content_ratings:
----> 8      proportion[key] = [key] / total_number_of_apps
      9      c_ratings_proportions [key] = proportion
     10      percentage = proportion * 100

TypeError: unsupported operand type(s) for /: 'list' and 'int'

Any help correcting what I’ve asked the computer to do?

You’ll want to loop over both the key and value in your for loop to avoid this error:

for key, value in content ratings:
    proportion[key] = value / total_number_of_apps

With that said, it does look like there may be a few more things wrong with your code — I’ll leave that for you to continue to work on though.