#537 · Dictionaries and sets · Beginner · 30 XP · about 5 min
Write letter_counts(text) that returns a dictionary mapping each letter in text to the number of times it appears.
letter_counts('Hello') # returns {'h': 1, 'e': 1, 'l': 2, 'o': 1} letter_counts('A-ha!') # returns {'a': 2, 'h': 1} letter_counts('123') # returns {}
First solves only, ranked by stars and then time.