removing all duplicates except one

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 … Read more