# By Heidi Newton dictionary_words = [] def start_spell_checker(): read_dictionary() while True: text_to_check = input("Enter a sentence to spell check or 'Q' to quit: ") if text_to_check == 'Q': break check_text(text_to_check) print("Thankyou for using the spell checker program!") #Read the dictionary file. Each word is on a seperate line. def read_dictionary(): global dictionary_words file = open("dictionary.txt", "r") for line in file.readlines(): dictionary_words.append(line.rstrip()) #The rstrip removes the new line character from the word def check_text(text_to_check): list_of_words = text_to_check.split() for word in list_of_words: if word not in dictionary_words: print(word) #Could have also done this by using a student implemented split method. #This avoids the need for the use of split, and actually demonstrates some list like stuff # (as strings are just collections in python). start_spell_checker()