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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Maiia Spivak](https://secure.gravatar.com/avatar/f4ea18f90330484c9d2d635ac0905e69?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Maiia Spivak
3,038 PointsNo idea what the system wants.
I keep getting the following message:
Bummer! string_factory() missing 1 required positional argument: 'my_dict'
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'},
{'name': 'Walter',
'food': 'pancakes'},
{'name': 'Galactus',
'food': 'worlds'}
]
string = "Hi, I'm {name} and I love to eat {food}!"
def string_factory(my_string, my_dict):
my_list = []
for key in my_dict:
my_list.append(my_string.format(**key))
return(my_list)
1 Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
231,007 Points
Your function takes the wrong number of arguments.
The challenge asks you to create a function "that accepts a list of dictionaries as an argument". It may be a list, but it's just one argument.
The function you have above takes two arguments (my_string and my_dict). So when the challenge tries to test it by passing a single argument, that's why you see the error complaining about missing an argument.
Also, you should not alter the code provided by the challenge. In this case, the name of template string should still be "template". And where did this "dicts" come from? It's neither provided, nor asked for in the challenge. It looks like it came from the retired version of this course (but that's not what your link points to). Are you trying to work both versions at once?
Maiia Spivak
3,038 PointsMaiia Spivak
3,038 PointsThank you for a quick response!
When I try to keep one argument instead, I get the following message: Bummer! I couldn't import
string_factory
.Steven Parker
231,007 PointsSteven Parker
231,007 PointsYou might want to post a new question.
Include your revised code, and make sure you're working on the correct version of this course!
Maiia Spivak
3,038 PointsMaiia Spivak
3,038 PointsThank you Steven! I tried to use variable names from the example, and it worked.