I have a list which has repeating items and I want a list of the unique items with their frequency.
For example, I have [\'a\', \'a\', \'b\', \'b\', \'b\']
[\'a\', \'a\', \'b\', \'b\', \'b\']
Here's one way:
your_list = ['a', 'a', 'b', 'b', 'b'] count_dictionary = {} for letter in your_list: if letter in count_dictionary: count_dictionary[letter] +=1 else: count_dictionary[letter] = 1