Screen Link:
https://app.dataquest.io/c/112/m/350/guided-project%3A-profitable-app-profiles-for-the-app-store-and-google-play-markets/10/most-common-apps-by-genre-part-two
My Code:
table_percentages = {}
for key in table:
percentage = (table[key] / total) * 100
table_percentages[key] = percentage
What I expected to happen:
i didnt understand how the percentages will add up into the tabel_percentages
What actually happened:
Replace this line with the output/error
I am not sure I entirely understand your question, but the percentages aren’t being added up. You are only calculating the percentages and storing them in that dictionary.
my question is about; how this percentages are sorting into that dictionary as we don’t have any kind of operation shows how we are putting the percentages values into the dictionary , i see that we have
table_percentages[key] = percentage.
but how this will be applied to the rest of the dictionary keys? thank you in advance
That is the line of code that puts the percentages into the dictionary. percentage
is the value and key
is the key for the dictionary.
The code is inside a for loop that iteratives over all the keys in table
. That’s how the dictionary table_percentages
gets populated.
ah , ok thanks for your explanation, that helps