title: Would I use closure for this?
body: <p>How would I mimic this result</p>
  
  <pre><code>&gt;&gt;&gt; countthesewords = wordcounter("~/mybook.txt")
  &gt;&gt;&gt; countthesewords['coffee']
  15
  </code></pre>
  
  <p>I'm guessing that you would first need to do a def within a def,</p>
  
  <pre><code>#filename is wordcountingprogram
  
  def wordcounter(filename):
      txtfile = open(filename, 'r')
      txtstr = txtfile.read()
  wordcounter = txtstr ?????
  </code></pre>
  
  <p>I think I'm supposed to turn the file into a library, but how do I get it so you can call it like that?</p>
  
  <p>I got it, Thank you for all who helped!</p>