Hi, I need to create a spell checking program where:
- the dictionary is loaded in as a set()
- the 2nd file is input by the user
- all words that are not in the dictionary are added to a list and printed out
My code so far is:
Dictionary = set(open("e:/assignment/dictionary.txt"))
SearchFile = open(input("Please Enter a File Path: "))
WordList = set()
for line in SearchFile:
SearchFile.readline()
if line in Dictionary:
SearchFile.readline()
else:
WordList.add(line)
SearchFile.readline()
print(WordList)
The current results it gives me are a mixture of words that are in the dictionary file, but also the words that aren't.
Please Help, any help is greatly appreciated!