Let’s consider again the count we did for the list `['4+', '4+', '4+', '9+', '9+', '12+', '17+']`

. To perform the count while finding the unique values automatically, we will:

- Create an
**empty dictionary**named`content_ratings`

. - Loop through the list
`['4+', '4+', '4+', '9+', '9+', '12+', '17+']`

, and check for every iteration whether the iteration variable (`c_rating`

) exists as a key in`content_ratings`

.- If it exists, then increment the dictionary value at that key by
`1`

. - Else (if it doesn’t exist), create a new key-value pair in the
`content_ratings`

dictionary, where the dictionary key is the iteration variable (`c_rating`

) and the dictionary value is`1`

.

- If it exists, then increment the dictionary value at that key by

https://app.dataquest.io/m/314/dictionaries-and-frequency-tables/8/finding-the-unique-values

Hi all,

I am working through how to find unique values in dictionaries. In this case, content_ratings is an empty dictionary, which I was asked to create. However, in the for loop, check for every iteration whether the iteration variable (`c_rating`

) exists as a key in `content_ratings`

. I am confused that if content_ratings is empty, how can you check whether there is any key exist? Please clarify and thank you.

Roni