Sign up Free. Don't forget to check out our challenges, lessons, solve and learn series and more ...

Code Snippet

python_words = {'list': 'A collection of values that are not connected, but have an order.',
                'dictionary': 'A collection of key-value pairs.',
                'function': 'A named set of instructions that defines a set of actions in Python.',

def show_words(python_words):
    # A simple function to show the words in the dictionary.
    display_message = ""
    for word in python_words.keys():
        display_message += word + '  '

# Print each meaning, one at a time, and ask the user
#  what word they think it is.
for meaning in python_words.values():
    print("\n%s" % meaning)

    # Assume the guess is not correct; keep guessing until correct.
    correct = False
    while not correct:
        print("\nWhat word do you think this is?")
        guessed_word = input("- ")    
        # The guess is correct if the guessed word's meaning matches the current meaning.
        if python_words[guessed_word] == meaning:
            print("You got it!")
            correct = True
            print("Sorry, that's just not the right word.")

Try it yourself