title: Python Spell Check Replace in Dictionary
body: <p>I'm writing a spell check function that takes a sentence or sentences as a list and then I have to go through the words and see if 1)they are in the wordList (it's a list of words from a Webster Dictionary) and if they are in the list print them or 2)if they're not in that wordList then I need to check to see if it's in this dictionary I created which has replacement words for commonly misspelled words: example- <code>{'cta':'cat','teh':'the'}</code> and if the word is in the key place in that dictionary I need to replace it with the correct spelling of it which is in the value place. My function is much longer than this but this is the portion I am struggling with-</p>
  
  <p>separate is my original sentence that has been turned into a list of words, wordList is the list of words from the Webster Dictionary, and d is the dictionary which contains the commonly misspelled words and their replacement. </p>
  
  <pre><code>newList=[]
  for line in separate:
      for word in line:
          if word in wordList:
              newList.append(word)
          elif word in d:
              for {i:c} in d:
                  newList=newList.replace(i,c)
  return newList
  </code></pre>