Hi guys,
I do not quite understand what is happening here.
content_ratings = {‘4+’: 4433, ‘12+’: 1155, ‘9+’: 987, ‘17+’: 622}
total_number_of_apps = 7197
c_ratings_proportions = {}
c_ratings_percentages = {}
for each in content_ratings:
proportion = content_ratings[each] / total_number_of_apps
c_ratings_proportions[each] = proportion
c_ratings_percentages[each] = c_ratings_proportions[each]*100
print(c_ratings_proportions)
print(c_ratings_percentages)
We created this c_ratings_proportions dictionary and we defined proportion within the for loop. However, how does the program assign keys to the c_ratings_proportion. We just tell it to pull proportions from the proportion variable we defined, nothing more.