I wanted to assign “content_ratings[erating] / total_number_of_apps” to a variable then use it to perform percentage, that way I could extract percentage_17_plus directly, but it’s not working out
In order to do what you want to do, you would need to initialize both props and perc as empty dictionaries before the loop (props = {} and perc = {}). Then Python can populate each dictionary with the results of each line in the code. (Though there’s a typo in the 5th line to fix first.)
It’s possible to do everything without having to create 2 additional dictionaries though. You can reassign the results back to the original dictionary using content_ratings[erating] instead of props[erating], for example. It will update the values of the content_ratings dictionary.