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 trialalekseibingham
4,491 PointsI got the correct answer but I don't think I understand this very well.
Once we hit the double "*" topic I got very confused as to what its actually doing and why it worked in the .format. My best guess would be it worked because the dict they used to test our code holds both keys that are hard-coded into the {}, So there is no needing to worry about the names not matching.
1 Answer
Steven Parker
231,275 PointsIt sounds like your understanding is correct. Since the dictionary keys are the same as placeholder names, simply unpacking the dictionary provides everything needed by "format" to fill in the values.
alekseibingham
4,491 Pointsalekseibingham
4,491 Pointsnow if there were more in the dictionary then needed to fill the placeholders would python prevent an error from occurring by only utilizing what is needed? Or would we need to add our own preventative try and except block?