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

This instruction is weirdly constructed and am not sure what is asking me to do.

I wrote the following code, but they both give me wrong results: email_greeting = "{} loves {}, format(treehouse, name)" or email_greeting = treehouse + "loves" + name

Not sure why they are wrong.

3 Answers

Try this:

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

or

email_greeting = treehouse + " loves " + name
Ann Cascarano
Ann Cascarano
17,191 Points

Try ending your quotation marks before calling the format method, like this:

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

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

As both Ann Cascarano and adamtatusko pointed out, you're calling .format() incorrectly. Also, when doing string concatenation (adding strings together with +), you need to be sure and provide the necessary spaces inside of the strings. Python joins them exactly as is.