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

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

String formatting with dictionaries

Write a function named string_factory that accepts a list of dictionaries as an argument. Return a new list of strings made by using ** for each dictionary in the list and the template string provided.

Stuart Wright
Stuart Wright
41,120 Points

Can you please post what you have tried so far? That way we will be able to tell you where you've gone wrong.

1 Answer

Aleksei Marchishin
Aleksei Marchishin
9,344 Points

hey, here's a really simple to go, so take a time for think about other tasks. You'll work without treehouse community, so the will nobody to ask how to make it without any try. but if you were, anyway I can't see your code, so copy and paste tis code, and go on!

def string_factory(banana):
    basket = []
    for ant in banana:
        basket.append(template.format(**ant))
    return basket