I've applied the Counter function from the collections module to a list. After I do this, I'm not exactly clear as to what the contents of the new data structure would be characterised as. I'm also not sure what the preferred method for accessing the elements is.
I've done something like:
theList = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
newList = Counter(theList)
print newList
which returns:
Counter({'blue': 3, 'red': 2, 'yellow': 1})
How do I access each element and print out something like:
blue - 3
red - 2
yellow - 1