SyntaxFix
Write A Post
Hire A Developer
Questions
You can use a dictionary:
s = "asldaksldkalskdla" dict = {} for letter in s: if letter not in dict.keys(): dict[letter] = 1 else: dict[letter] += 1 print dict