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 trialRobert Hecht
6,797 Pointsdef favorite_food(dict): return "Hi, I'm {name} and I love to eat {food}!".format(name="Mike", food="Venison")
My answer looks exactly like the example and what they tell me it should look like in the Bummer example. What am I missing?
def favorite_food(dict):
return "Hi, I'm {name} and I love to eat {food}!".format(name="Mike", food="Venison")
2 Answers
Steven Parker
231,236 PointsThe example is not a solution to the challenge, it's only to illustrate how the arguments are used by the "format".
Your task is to provide values to the "format" that come from the "dict" that is provided as an argument to the "favorite_food" function. Hint: the instructions talk about "unpack that dictionary" so the "splat" operator ("**") might be useful.
Jamison Habermann
11,691 PointsHi there! The challenge is not asking you to copy what the example looks like, unfortunately. The challenge is asking you to unpack the dictionary that is passed in to the function. This automatically fills in the "name" and "food" placeholders. Check the teachers notes of the previous video.