title: List comprehension with averages
body: <p>I have a string, dictionary in the form:</p>
  
  <pre><code>('The puppy likes flowers',
   {'laughter': (8.5, 0.9313),
    'flowers': (7.88, 1.1718),
    'the': (4.98, 0.9145),
    'puppy': (7.58, 1.4581),
    'died': (1.56, 1.198),
    'laugh': (9.5, 0.1),
    'flow': (2.3, 0.51),
    'likes':(5.9, 0.032),
    'like':(6.5, 0.021)    
     }
    )
  </code></pre>
  
  <p>Each parentheses is a tuple which corresponds to (score, standard deviation). I'm taking the average of just the first integer in each tuple. I've tried this:</p>
  
  <pre><code>def score(string, d):
      if len(string) == 0:
          return 0
      string = string.lower()
      included = [d[word][0]for word in d if word in string]
      return sum(included) / len(included)
  </code></pre>
  
  <p>When I run:</p>
  
  <pre><code>print score ('The puppy likes flower', {'laughter': (8.5, 0.9313), 'flower': 
  (7.88, 1.1718), 'the':(4.98, 0.9145), 'puppy':(7.58, 1.4581), 
  'died':(1.56, 1.198),'laugh': (9.5, 0.1),'flow': (2.3, 0.51)})
  </code></pre>
  
  <p>I should get the average of only <code>'the'</code>, <code>'puppy',</code> <code>'likes'</code> and <code>'flowers'</code>: <code>4.98 + 7.88 + 5.9 + 7.58 / 4</code> but this running function also includes <code>'like'</code> and <code>'flow'</code> : <code>4.98 + 7.88 + 5.9 + + 7.58 + 6.5 + 2.3 / 6</code>.</p>