title: Converting Words from a Input into Values Python
body: <p>I am wondering how to convert words from an input into values in Python. The user would enter an input for example:</p>
  
  <pre><code>"The dog chased the cat the lion chased the dog"
  </code></pre>
  
  <p>I would then like it to return:</p>
  
  <pre><code>["1,2,3,1,4,1,5,6,1,2"]
  </code></pre>
  
  <p>I would like duplicate words to retain the same value as when the word first occurred. I have tried to do this multiple ways, I am using the following code at the moment, but it seems to return random indexes:</p>
  
  <pre><code>l = input("Enter a sentence").lower lists= list(l) valueindex = range(len(lists)) print(valueindex)
  </code></pre>
  
  <p>Thanks for the help,
  Izaak</p>