Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

What am I doing wrong?

I have looked at different answers online where people are having issues with this problem as well. It keeps saying Bummer! string_factory() missing 1 required positional argument: 'string'. I am stuck and I have tried everything I can think of. Its most likely something small but like I said others have been having this issue as well and I'm getting frustrated lol. PLEASE HELP!

# Example:
# values = [{"name": "Michelangelo", "food": "PIZZA"}, {"name": "Garfield", "food": "lasagna"}]
# string_factory(values)
# ["Hi, I'm Michelangelo and I love to eat PIZZA!", "Hi, I'm Garfield and I love to eat lasagna!"]

dicts = [
    {'name': 'Michelangelo',
     'food': 'PIZZA'},
    {'name': 'Garfield',
     'food': 'lasanga'},


string = "Hi, I'm {name} and I love to eat {food}!"

def string_factory(dicts, string):
    string_list = []

    for dict in dicts:

    return string_list

1 Answer

Pete P
Pete P
7,613 Points

I believe the function string_factory should only take one argument - the list of dictionaries. No need to include 'string' as an argument and no need to define the 'dicts' yourself. The only code you need to write is the function string_factory. Looks to me like your code will work once you fix the above.

def string_factory(dicts):

    #  Your code here

    return string_list