top of page
Search

PYTHON CODING

  • Writer: waclaw_koscielniak
    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

Try to run it to verify the result.
Try to run it to verify the result.
















 
 
 

1 Comment


Guest
Jul 31

Did you try it?

Like
bottom of page