I am creating a list in Python using .split. My code splits the user's input into a list. I am wondering on how I can stop the program printing duplicates of the word in the sentence. My code is currently this:
sentence = input("Enter a sentence").lower()
sentencesplit = sentence.split()
print(sentencesplit)
When I enter "Run run Forrest run" it will return:
['run', 'run', 'Forrest', 'run']
But I want it to return only run and Forrest, I want it to only list the same word once. Does anyone know a way of doing this? I need to keep the order, so the question's similar to this do not help me, so don't mark this a duplicate, just leave and move on with your life.
Thanks, Izaak