Before answering these questions, first we need to understand what is a dictionary and how it works in Python?
A dictionary is a collection of key and value pairs. Below are some of the ways we can use a dictionary:
# initialize a dictionary
myDict = {}
# add a new key to a value in dict
myDict[new_key] = new_val
# access a value from a dictionary with a key
myDict[new_key] # return new_val
After getting that out of the way, let take a look at your questions.
a. what do the keys in the dictionary stored in "answer" represent?
--> That's great that you recognized "answer" is a dictionary. If you look at the function, mystery(), var "d" is the dictionary that is returned, hence it will be stored in answer.
My question to you is what keys are added to dictionary "d" in the function. Specifically, what does the 6th line do in the code " d[n] = [w]" ? (Hints: check the common usage of dict I provided above). What's "n" in d[n]? (Hints:n = len(w)) , what is len(w)?
b. This question is a followup question, once you get question "a", you should be able to answer this question.
I strongly recommend you using http://www.pythontutor.com to visualize your code. Good luck. Please leave a comment below if you still have questions.