Screen Link:
My Code:
content_ratings = {‘4+’: 4433, ‘12+’: 1155, ‘9+’: 987, ‘17+’: 622}
total_number_of_apps = 7197
c_ratings_Proportions = {}
c_ratings_percentages = {}
for key in content_ratings:
proportion = content_ratings[key]/total_number_of_apps
percentage = proportion*100
print(key)
print(proportion)
c_ratings_proportions[key] = proportion
c_ratings_percentages[key] = percentage
What I expected to happen:
Expected output without error
What actually happened:
NameErrorTraceback (most recent call last)
in ()
8 print(key)
9 print(proportion)
—> 10 c_ratings_proportions[key] = proportion
11 c_ratings_percentages[key] = percentage
12
NameError: name ‘c_ratings_proportions’ is not defined
please let me know reason. Thanks in advance