Demo entry 6771810

question1

   

Submitted by anonymous on Nov 20, 2018 at 23:07
Language: Python 3. Code size: 234 Bytes.

### Yona Bohbot 340862028
#Question 1

def freq(words):
   word = {}
   for w in words.split():
        word[w] = word.setdefault(w,0) + 1
   return word

words = "cat dog dog cat bird dog mousse"     
print(freq(words))  

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).