Python Python Collections Dictionaries String Formatting with Dictionaries

Kudakwashe Chatikobo
Kudakwashe Chatikobo
1,010 Points

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

i need help

string_factory.py
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'))
        print(result)

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

1 Answer

Steven Parker
Steven Parker
168,137 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.