Hi, I have been learning Python and have a quick dictionary question.

I am trying to make a "vocabulary test" to help myself study, and am trying to do it with a dictionary. So far I have this:

testwords = {"uno":"one","dos":"two","tres":"three","cuatro":"four",\
             "cinco":"five"}

def vocabtest():
    for value in testwords:
        print "What word does the following definition correspond with?"
        print value
        answer = raw_input("> ")
        if answer == :
            print "Correct!"

vocabtest()

I need help with line 9, "if answer == :".
I am not sure how I would check to see if the user's answer is equal to the corresponding key.

Any help would be greatly appreciated. Thanks.

An appropriate variable name in the for loop would be key instead of value, because you are iterating on the keys of the dictionary.

if answer == testwords[key]:

I guess you want to write this

def vocabtest():
    for value in testwords:
        print "What word does the following definition correspond with?"
        print value
        answer = raw_input("> ")
        if (answer == testwords[value]):
          print "Correct!"
        else:
          print "No the answer is ",testwords[value]
commented: Perfect answer. +1

Thank you very much! Problem solved!