PYTHON CODING
- waclaw_koscielniak

- Jul 31
- 1 min read
from collections import Counter
def letter_counts(word):
c = Counter(word)
for k, v in c.items():
yield k, v
print(dict(letter_counts("apple")))
[Running] python3 -u "/Users/name/test/test54.py"
{'a': 1, 'p': 2, 'l': 1, 'e': 1}
[Done] exited with code=0 in 0.051 seconds



Did you try it?