title: Find all occurrences of a word in a list?
body: <p>I want to be able to identify all of the positions where a word appears in a sentence.</p>
  
  <p>For example: Hello my name is Ben and his name is Fred.</p>
  
  <p>If I input 'name' it should return: This word occurs in the places: 3 and 8</p>
  
  <p>Below is my code however it will only return the first value.</p>
  
  <pre><code>text = input('Please type your sentence: ')
  sentence = text.split()
  word= input('Thank-you, now type your word: ')
  
  if word in sentence:
              print ('This word occurs in the places:', sentence.index(word)+1)
  elif word not in sentence:
              print ('Sorry, '+word+' does not appear in the sentence.')
  </code></pre>