News for hackers. Stuff that matters.
Re:LINQ Ruined My Favorite Interview Question by wiredfool on Thursday July 11, 2013 @02:23PM (#6028030)
Or, use a defaultdict(int), or more in line with yours:

d[word] = d.get(word,0) + 1

dictionary.get is quite useful.

Also, I'd consider s.split(None), instead of s.split(' '). It will group whitespace, so that any double space or other whitespace is collapsed into one delimiter.

Re:LINQ Ruined My Favorite Interview Question by bereft_orange on Thursday July 11, 2013 @06:42PM (#6029763)
or just `s.split()`
Re:LINQ Ruined My Favorite Interview Question by shill on Thursday July 11, 2013 @02:43PM (#6028207)
I didn't know about split(None). Thanks!