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!

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


String Factory

What I'm I doing wrong? I search this forum and tried this so many ways.

Bummer: format() argument after ** must be a mapping, not str

dicts = [
    {'name': 'Michelangelo',
     'food': 'PIZZA'},
    {'name': 'Garfield',
     'food': 'lasanga'},
    {'name': 'Walter',
     'food': 'pancakes'},
    {'name': 'Galactus',
     'food': 'worlds'}

def favorite_food(dicts):
    string = "Hi, I'm {name} and I love to eat {food}!"
    result = []
    for i in dicts:
    return result
Steven Parker
Steven Parker
225,652 Points

Please provide a link to the course page you are working with.

2 Answers

Steven Parker
Steven Parker
225,652 Points

This code is very different from the challenge shown in the linked page. The one in the page has a function of the same name, but it only operates on a single dictionary and returns a single string result. And the challenge only asks you to supply the argument to the "format" call, you won't need to write any new lines of code.

Check that you've provided a link to the correct page, and if so, re-read the instructions carefully