easy python program, not easy for me
<p>I have to write a program that has four different word game options.</p>

<p>One of the options is that the user inputs a certain length of a word from a dictionary file and then the program finds a word with that length that can be made up of the abbreviations for the 50 states of USA.</p>

<p>Ex: if the user inputs 6, then the program finds the word MARINE, which is made up of 5 abbreviations: MA (Massachusetts), AR (Arizona), RI (Rhode Island), IN (Indiana), and NE (Nebraska).</p>

<p>I have this so far:</p>

<pre><code>elif choice == "d":
    #wordlen = length of words user is looking for.
    wordlen = raw_input("Enter the length of words you are looking for: ")
    wordlen = int(wordlen)
    print wordlen

    states = ['AL','AK','AZ','AR','CA','CO','CT','DE','DC','FL','GA','HI',\
    'ID','IL','IN','IA','KS','KY','LA','ME','MD','MA','MI','MN','MS','MO','MT',\
    'NE','NV','NH','NJ','NM','NY','NC','ND','OH','OK','OR','PA','RI','SC','SD',\
    'TN','TX','UT','VT','VA','WA','WV','WI','WY']

    for line in file:
        line = line.strip()
        line = line.upper()

        if len(line) == wordlen:
</code></pre>

<p>I have already opened the dictionary file (file = file.open('dictionary.txt') at the beginning of the whole loop and used file.seek(0) and then when the loop is broken (when the user inputs 'q'), file.close() so that I don't have to open and close the file during each procedure.</p>

<p>And after I have the condition that the user inputs, I don't know what to do. I've tried everything and it doesn't give me the expected output. Help please? This is my first year taking python and it's very confusing to me -__-</p>
