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 trialEthan Koren
6,277 Pointsstring_factory.py
what do i need to do here? unclear
# 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!"]
template = "Hi, I'm {name} and I love to eat {food}!"
1 Answer
behar
10,799 PointsIm not sure wether you actually want the solved code? However the challenge asks you to create a function called string_factory that will take a single variable. This variable will be a list of dictonaires that has names and foods in them. Now it simply wants you to append the dictoniary content into the template provided and append this to a list. Once your done doing this for every dictonaire that the list contains, return the new list to the function. Please comment if you need actual code for this!
Ethan Koren
6,277 PointsEthan Koren
6,277 PointsCheers Behar, Id like the code please if you have it because I still cant figure it out. Thank you
behar
10,799 Pointsbehar
10,799 PointsHope this helps!