""" also assumed that findword loaded the dictionary within it """ wordList = [] file = open("input.txt") for line in file: wordList.extend(line.split()) misspelledWords = [] for word in wordList: if isword(word): if not findword(word): misspelledWords.append(word) misspelledWords.sort() for item in misspelledWords: numberOfTimes = misspelledWords.count(item) print item, '(', numberOfTimes, ')' while misspelledWords.count(item) > 1: misspelledWords.pop(misspelledWords.index(item))