""" Purpose: spell check a line of input """ # import get module for url supoprt import url # define link for spelling dictionary WORDS_FOLDER_URL = "http://www.cs.virginia.edu/~cs1112/datasets/words/" SPELLING_LIST_URL = WORDS_FOLDER_URL + "most-common" # get the spelling list as a list of words spellings = url.get_contents( SPELLING_LIST_URL ) spellings = spellings.split() # get the user text as a list of words (in canonical form) text = input( "Enter text: " ) text = text.lower() # make it all lowercase to match our dictionary text = text.split() # make it a list so we can search through it # consider the words one by one -- determine whether current word is misspelled. for word in text : # check to see if the word is correctly spelled if ( word not in spellings ) : # is our current word not in the list of common English words? --> misspelled print( word ) # if our condition passes, print the current value of our loop variable, word # we don't need an else statement, because if the word is correctly spelled we don't do anything # all done