I am trying to find how to print the indexes of words in a list in Python. If the sentence is "Hello world world hello name") I want it to print the list "1, 2, 2, 1, 3")
I removed all duplicates of words with this:
sentence = input("Enter").lower()
words = sentence.split()
counts = []
for word in words:if word not in counts:counts.append(word)
print(counts)
But I need to still get indexes of the sentence using an array