title: Doubts about string
body: <p>So, I'm doing an exercise using python, and I tried to use the terminal to do step by step to understand what's happening but I didn't.</p>
  
  <p>I want to understand mainly why the conditional return just the index 0.
  Looking <code>'casino' in [Casinoville].lower()</code> isn't the same thing?</p>
  
  <h1>Exercise:</h1>
  
  <ul>
  <li>Takes a list of documents (each document is a string) and a keyword. 
  Returns list of the index values into the original list for all documents containing the keyword.</li>
  </ul>
  
  <h2>Exercise solution</h2>
  
  <pre><code>def word_search(documents, keyword):
      indices = [] 
      for i, doc in enumerate(documents):
  
          tokens = doc.split()
          normalized = [token.rstrip('.,').lower() for token in tokens]
  
          if keyword.lower() in normalized:
              indices.append(i)
      return indices
  </code></pre>
  
  <h2>My solution</h2>
  
  <pre><code>def word_search(documents, keyword):
      return [i for i, word in enumerate(doc_list) if keyword.lower() in word.rstrip('.,').lower()]
  </code></pre>
  
  <h2>Run</h2>
  
  <pre><code>&gt;&gt;&gt; doc_list = ["The Learn Python Challenge Casino.", "They bought a car", "Casinoville"]
  </code></pre>
  
  <h3>Expected output</h3>
  
  <pre><code>&gt;&gt;&gt; word_search(doc_list, 'casino')
  &gt;&gt;&gt; [0]
  </code></pre>
  
  <h3>Actual output</h3>
  
  <pre><code>&gt;&gt;&gt; word_search(doc_list, 'casino')
  &gt;&gt;&gt; [0, 2]
  </code></pre>