You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<Arrinao> sentence = input("Enter a sentence: ")
<Arrinao> counts = {}
<Arrinao> for word in sentence.split():
<Arrinao> counts[word] = counts.get(word, 0) + 1
<Akuli> two cases: word is not in counts, word is in counts
<Akuli> word not in counts: counts[word] = 0+1
<Akuli> s o when we see it for the first time, set count to 1
<Akuli> and when word is in counts, it does: counts[word] = counts[word] + 1
<Akuli> so when we see a word we already saw before, we increment the count
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: