i am trying to get the positions of the word the user types in, but I can only find the position if the word only appears once in the sentence, how do I find the position if the inputted word appears multiple times in the sentence?
if varInput in varwords:
print ("Found word")
#prints total number of words
print("The total number of words is: " + str(len(varwords)))#http://stackoverflow.com/questions/8272358/how-do-i-calculate-the-number-of-times-a-word-occurs-in-a-sentence-python
#finds out how many times the word occurs in the sentence
wordOcc = (varwords.count(varInput))
#if word occurence = 1 then print the position of the word
if wordOcc ==1:
pos = varwords.index(varInput)
pos = pos+1
print("the word "+varInput+" appears at position:")
print(pos)
else if wordOcc =>2:
pos1 = varwords.index(varInput)