This is a question from pyschools.
I did get it right, but I\'m guessing that there would be a simpler method. Is this the simplest way to do this?
In 2.7+:
import collections letters = collections.Counter('google')
Earlier (2.5+, that's ancient by now):
import collections letters = collections.defaultdict(int) for letter in word: letters[letter] += 1