title: word frequency program in python
body: <p>Say I have a list of words called words i.e. words = ["hello", "test", "string", "people", "hello", "hello"] and I want to create a dictionary in order to get word frequency.</p>
  
  <p>Let's say the dictionary is called 'counts'</p>
  
  <pre><code>counts = {}
  for w in words:
      counts[w] = counts.get(w,0) + 1
  </code></pre>
  
  <p>The only part of this I don't really understand is the counts.get(w.0).  The book says, normally you would use counts[w] = counts[w] + 1 but the first time you encounter a new word, it won't be in counts and so it would return a runtime error.  That all fine and dandy but what exactly does counts.get(w,0) do?  Specifically, what's the (w,0) notation all about?</p>