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 trialSimbarashe Banga
1,342 PointsCode challenge not working but executing in workspace
I'm having a challenge of executing the code challenge, which I have tested in workspaces however, and is working
def favorite_food(name=None, food=None):
print("I'm {} and I love to eat {}!".format(name,food))
1 Answer
Steven Parker
231,275 PointsSure, that function works, but only if you give it two string arguments. It uses a different function signature than what's in the challenge. The function in the challenge takes a single dictionary argument, and the challenge is going to pass it a single dictionary argument when it tests it.
Your task is to use that dictionary to create the proper output. Don't change the "def" line!
Samuel Pitt
3,032 PointsSamuel Pitt
3,032 Points[EDIT:] original"Hi Steven Parker, could you elaborate. I'm stuck too. do we need to use dict{something something} in the format line? the 'def' line contains only dict in the arguments..."
i worked it out!!!! the question doesnt inform you that it will pass its own values in and simply use your function. leave the original line 1 unchanged, then in the format, unpack "dict". HINT: **
Steven Parker
231,275 PointsSteven Parker
231,275 PointsSimbarashe Banga — did you get it too? You can mark a question solved by choosing a "best answer".