Linear search through a file with data and a file with words (for example, like a spell check)
<p>I am unsure of why my code is not working. This is a function from a program I have to implement.</p>

<pre><code>def spellcheck_list(document, dictionary):
    """
    Checks the spelling of each word in 'document' (a list of words) against
    the dictionary (another list of words).
    """
    pos = 0
    found = False
    stop = False

    for word in document:
        while pos &lt; len(dictionary) and found:
            if document[pos] in dictionary:
                found = True

            else:
                pos = pos+1
                print word
</code></pre>
