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 trial

Python Python Basics (Retired) Ins & Outs Ins & Outs

concatenation

problem with the placeholders

name.py
name = 'dupree'
treehouse = "Tree" + "house"
email_greeting = ""X loves Y" but with" {}+"for X and"{}+" for Y".format(treehouse,name)

2 Answers

Samuel Webb
Samuel Webb
25,370 Points

You're trying to make it a little more complicated than you need to. In this example you're not using the .format() function. You can just use simple concatenation to achieve this. Your code should look like this for the final line:

email_greeting = treehouse + " loves " + name

The code below works ..... Dupree! you were on the right track( your initial attempt helped with this solution)

the first place holder {} stands for X and the second place holder {} stands for Y

 email_greeting = ("{} loves {} ".format(treehouse,name))
Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Why do you have parentheses around the entire string?

I assumed that because we are using python 3.4 a parentheses was needed. I've just realized that isn't the case :)

Dupree! Below is the new improved code :)

email_greeting = "{} loves {} ".format(treehouse,name)