title: Return the number line a list of words is in?
body: <p>I need help with a problem in which I create a function called index() which takes a file as a string and a list of words. The program will find the number lines that each word is in and return the number line next to the word.</p>
  
  <p>So far my code reads as:</p>
  
  <pre><code>    f=open(file,'r')
      read = f.readlines()
  
      for word in lst:
          if word in range(len(read)):
              word[:]+1
      return read
  </code></pre>
  
  <p>I am pretty stuck here but I think you're supposed to search the index of the list of readlines(). For this problem I have to use for loops and format. Can anyone help me?</p>
  
  <p>For FYI the return will look like this:</p>
  
  <pre><code>index('raven.txt',['raven','mortal','dying','ghost','ghastly','evil','demon])
  
  ghost     9
  dying     9
  demon     122
  evil      99, 106
  ghastly   82
  mortal    30
  raven     44, 53, 55, 64, 78, 97, 104, 111, 118, 120
  </code></pre>
  
  <p>Also I am using python 3.</p>