Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialnewpal
1,717 Pointswhat is wrong with this code?
def favorite_food(**dict): return "Hi, I'm {name} and I love to eat {food}!".format(name= dict["name"], food = dict["food"])
def favorite_food(**dict):
return "Hi, I'm {name} and I love to eat {food}!".format(name= dict["name"], food = dict["food"])
3 Answers
Holden Glass
6,077 PointsI went and looked at the problem and you are being passed a dictionary, not multiple arguments that you need to pack into a dictionary, I think. Try leaving the parameter as dict with no ** and try using it as a dict in the format.
Holden Glass
6,077 PointsThe name that you used for your parameter is a python keyword. Something like def favorite_food(**a_dict): should work.
newpal
1,717 PointsThank you Holden, I tried the following:
def favorite_food(**a_dict): return "Hi, I'm {name} and I love to eat {food}!".format(name= a_dict["name"], food = a_dict["food"])
But that did not work either!
newpal
1,717 PointsThanks Holden! That did it!