Need help, specifically with removing repeated word in list : I need to develop a program in which it takes in a user inputted string, e.g. ‘to be or not to be’. Then separate the string into its separate words, ‘to’, ’be’, ’or’, ’not’, ’to’, ’be’. The words are then put into a list, [‘to’, ’be’, ’or’, ’not’, ’to’, ’be’] where they are changed into their position in the list. However, if a word is repeated, only the first use of the word is counted and replaced with its position number. So, for example, both ‘to’s in ‘to be or not to be’ will be counted as 1. This is because the word ‘to’ is repeated and so the first appearance of ‘to’ accounts for both of the words. After the words are replaced with their position number, the sentence should be recreated with these numbers. So ‘to be or not to be’ should become ‘1, 2, 3, 4, 1, 2’. The list of both words and numbers should be saved as either separate files or one single file. 
This is all i have so far:

    UserSentence = input('Enter your chosen sentence: ') #this is where the user inputs their sentence
    UserSentence = UserSentence.split()#.split()takes the inputted string and breaks it down into individual words...
                                   #... and turns it into a list
    List1 = UserSentence
    List2 = UserSentence