Hi @brayanopiyo18,
thanks for your reply.
Yes, I am referring tot he output.
Am I missing something in the example code on this mission?
Is there an error in the example provided?
The order of the key:Value pair is displayed differently in the output compared to the initial iterable dictionary - content_ratings
The initial content_ratings = {β4+β: 4433, β9+β: 987,β12+β: 1155, β17+β: 622}
Note the order of the keys - β4+β, β9+β, β12+β, β17+β
and the output (in the example) is:
{β9+β: 0.13714047519799916, β12+β: 0.16048353480616923, β4+β: 0.6159510907322495, β17+β: 0.08642489926358204}
{β9+β: 987, β12+β: 1155, β17+β: 622,β4+β: 4433}
note the order of the keys is now:
c_ratings_proportions β9+β, β12+β, β4+β, β17+β
content_ratings β9+β, β12+β,β17+β, β4+β
Since my original post, I ran the code provided and I got a different output to that shown in the example. The output which I have now does make sense to me, in that it is in the same order. Much like the example you provided.
Here is my code below:
content_ratings = {β4+β: 4433, β9+β: 987, β12+β: 1155, β17+β: 622}
total_number_of_apps =7197
c_ratings_proportions={}
for key in content_ratings:
proportion = content_ratings[key]/total_number_of_apps
c_ratings_proportions[key]=proportion
print(c_ratings_proportions)
print(content_ratings)
and output:
{β4+β: 0.6159510907322495, β9+β: 0.13714047519799916, β12+β: 0.16048353480616923, β17+β: 0.08642489926358204}
{β4+β: 4433, β9+β: 987, β12+β: 1155, β17+β: 622}
I hope this question makes sense.