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 trialMarco Grier
iOS Development with Swift Techdegree Student 1,740 PointsString 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:
result.append(string.format(**i))
return result
2 Answers
Marco Grier
iOS Development with Swift Techdegree Student 1,740 PointsSteven Parker
231,108 PointsThis 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
Steven Parker
231,108 PointsSteven Parker
231,108 PointsPlease provide a link to the course page you are working with.