I'm trying to remove all the duplicate words except for two certain words.
def reduceDuplicates(words, wordsIter):
theWords=set()
for word in words:
if word!=FIRST or word!=LAST: #FIRST="first" #LAST="last"
if word not in theWords:
theWords.add(word) #create new txt file
else:
break
words.__init__(theWords) #call constructor to print
Does anybody know where to go with this? I've tried everything I can think of. The words "first" and "last" in my txt file keep losing their duplicates. I'm trying to keep those duplicates.
wordsIter is a list iterator that is supposed to handle mutator and accessor methods on the list of words variable