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 trialBryan Sory
1,978 Pointswhere does str.format go in this one?
name = 'Bryan' treehouse = "Tree" + "house" email_greeting = treehouse + 'loves' + name
name = 'Bryan'
treehouse = "Tree" + "house"
email_greeting = treehouse + 'loves' + name
1 Answer
Andreas cormack
Python Web Development Techdegree Graduate 33,011 PointsHi Bryan
You can call the format method on any string. The format method allows you to substitue placeholders in a string with passed in variables. These variables or values must be passed in order of the placeholders in the string. So to create a string called 'Treehouse loves bryan' you could do this "{} loves {}".format("Treehouse","bryan").
for the sake of this challenge you do it like so.
name = 'Bryan'
treehouse = "Tree" + "house"
email_greeting = "{} loves {}".format(treehouse,name)