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 trial

Python Python Collections (2016, retired 2019) Dictionaries String Formatting with Dictionaries

I keep getting a bummer, saying output from my function must be a string. I'm stuck

i need help

def favorite_food(name='Kenneth', food = 'tacos'):
    if  name and food:
        result = print(""" "Hi, I'm {name} and I love to eat {food}!" """.format(name= 'Kenneth',food= 'tacos'))

favorite_food(**{'name':' Kenneth', 'food' :'tacos'}) 

1 Answer

Steven Parker
Steven Parker
229,582 Points

The instructions said "the favorite_food function ... accepts a dictionary as an argument.", and the supplied code did accept one named "dict". But what's shown here has been modified to take 2 string arguments instead.

Don't change the the function's calling signature!

Extra hint: you only need to fill in the argument(s) for the "format" call.