title: How to count a word in a list by using lambda?
body: <p>I have a text file like this: &quot;My name is John. My profession is mechanic. My car's color is black...&quot; After I convert this text file into a list, I want to search how many &quot;is&quot; there are in the text. To do that, I wrote that function but it is not working:</p>
  <pre><code>def count(word, my_list):
      print(functools.reduce(lambda x: &quot;word&quot; in x, my_list))
  </code></pre>
  <p>and I tried this</p>
  <pre><code>def count(word, my_list):
      result = sum(map(lambda x: &quot;word&quot; in x, my_list))
      print(result)
  </code></pre>
  <p>Both functions shows 0 instead of 3. I don't want to use loop.</p>