Value frequencies
Creates a dictionary with the unique values of a list as keys and their frequencies as the values.
- Use
collections.defaultdictto store the frequencies of each unique element. - Use
dict()to return a dictionary with the unique elements of the list as keys and their frequencies as the values.