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 trialGokul Ravichandran
209 Pointshelp on str.format
Finally, create a new variable named email_greeting that uses str.format to combine the treehouse variable, the word "loves", and the name variable with spaces between each item. eg: "Treehouse loves Andrew"
name="gokul"
treehouse="Tree" + "house"
email_greeting=print(treehouse +" loves " + name)
5 Answers
Chris Freeman
Treehouse Moderator 68,457 Pointsname = "gokul"
treehouse = "Tree" + "house"
email_greeting = "{} loves {}".format(treehouse, name)
Note that the preferred style is to include spaces around the equals sign.
Taha El Azezy
Python Development Techdegree Student 2,506 Pointsi did it!, Chris and it does not work email_greeting = "{} loves {}".format(treehouse, name) what is wrong with that so?!
Chris Freeman
Treehouse Moderator 68,457 PointsHi Taha, it might related to your other code. Can you post all your current code?
Taha El Azezy
Python Development Techdegree Student 2,506 PointsHi Chris, thanks for answering and your time as well :)
name = "Taha";
treehouse = "Tree" + "house";
email_greeting = "{} loves {}".format(treehouse, name)
Chris Freeman
Treehouse Moderator 68,457 PointsTaha, your code is very close. You need only one space surrounding "loves". you have two. remove the extra spaces and your good to go1
Taha El Azezy
Python Development Techdegree Student 2,506 PointsThanks, Chris Done, but tell me how did you know it ?
Chris Freeman
Treehouse Moderator 68,457 PointsI've seen how picky the checker can be on whitespace and punctuation.
Taha El Azezy
Python Development Techdegree Student 2,506 PointsOKay, Thank you again :)