title: python can not get the output right for dictionary
body: <p>the file contains following string:  </p>
  
  <pre><code>I have no pride     
  I have no shame   
  You gotta make it rain    
  Make it rain rain rain
  </code></pre>
  
  <p>output should look like this: </p>
  
  <pre><code> {'rain': [2, 3], 'gotta': [2], 'make': [2], 'it': [2, 3], 'shame': [1], 'I': [0, 1], 'You': [2], 'have': [0, 1], 'no': [0, 1], 'Make': [3], 'pride': [0]}
  </code></pre>
  
  <p>but I am getting this:  </p>
  
  <pre><code>{'I': 1, 'have': 1, 'gotta': 2, 'Make': 3, 'it': 3, 'rain': 3, 'You':
   2, 'no': 1, 'make': 2, 'shame': 1, 'pride': 0}
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>def lineIndex(fName):
      fileName=open(fName)
      contents=fileName.readlines()
      fileName.close()
      d={}
      lst=[]
      count=-1
      for line in  contents:
          if line not in lst:
              print(line)
              lst.append(line)
              count+=1
  
          t=line.split()
          y2=[]    
          for eachWord in t:
              #print(eachWord)
              if eachWord not in d:
                  y2.append(eachWord)
                  d[eachWord]=count
              if eachWord in d:
                  d[eachWord]=count
  
      return d
  </code></pre>