title: Python dictionary values
body: <p>Hi I am just starting to learn how to program and have a function that I need to write in Python, this is the idea behind it:</p>
  
  <p>It returns <code>True</code> if <code>word</code> is in the <code>wordList</code> and is entirely composed of letters in the hand. Otherwise, returns <code>False</code>. Does not mutate hand or wordList.</p>
  
  <p>There is a function to call that checks the frequency of the letters in the word the user comes up with and that is a converted to a dict, I have tried using iteritems various ways but to no avail, I am getting stuck on the words that have repeated letters, they are being returned as true when I don't have two entries for that letter in the users hand.</p>
  
  <p>Sorry if this is unclear I only started two weeks ago.
  any pointers would be great I have been stuck on this for a long time!</p>
  
  <pre><code>def isValidWord(hand,word,wordList):
  
      """
      Returns True if word is in the wordList and is entirely
  
      composed of letters in the hand. Otherwise, returns False.
  
      Does not mutate hand or wordList.
  
      word: string
      hand: dictionary (string -&gt; int)
      wordList: list of lowercase strings
      """
  
      wordC = getFrequencyDict(word)
      handC = dict.copy(hand)
      if word not in wordList:
          return False
      for c in word:
          if c not in hand:
              return False
          for k,v in wordC.iteritems():
              if k in hand and v &gt; 1:
                   handC[k] -= 1
  </code></pre>
  
  <p>basically my next step was trying to figure out how to compare word to handC with amended value and discounting any key with a value of zero.
  I think(hope) that will work.</p>