(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not. You can share the errors you get)
(Solution code removed, as posting it publicly is against the honour code of this community, regardless if it is correct or not. You can share the errors you get)
Please see my reply to your related question: KeyError on List data type . The list candy_data is a list of dictionaries, and the function get_popularity_scores expects a list of dictionaries as its argument, so you should directly use the function with its argument.
In your for loop, the “row” ends up iterating over the rows of the data, but each row is a dictionary, rather than an integer. So, for example, the first “row” is this:
{'Candy Name': 'Twix', 'Popularity Score': 92, 'Price in USD': 1.25}
The function get_popularity_scores is already defined so that it iterates over each of these dictionaries and gets the Popularity Score, so you don’t need to define the iteration yourself.
If you would like to, you can look at the definition of the function in Lab Files (the button in Coursera looks like this, near the Submit Assignment button)