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

Alfred Pennyworth
Alfred Pennyworth
6,260 Points

missing 1 required positional argument

I have tried this at workstation and it works. But when it comes to this challenge task it throws error "favorite_food() missing 1 required positional argument: food". Any idea? Thanks in advance.
diction = {"name":"sky" , "food":"taco"}
def favorite_food(name,food):
    return "Hi, I'm {} and I love to eat {}!".format(name,food)


1 Answer

Steven Parker
Steven Parker
200,783 Points

The instructions say that the function "accepts a dictionary as an argument", but it looks like you've changed the function signature (number and type of arguments).

You should not change the provided code except to fill in the argument(s) for the "format" function call.

You also won't need to call the function yourself or define any new variables. The challenge validation mechanism will take care of that.