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 trialAidaliz Maldonado
1,006 PointsThis 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
Adam Tatusko
16,589 PointsTry this:
email_greeting = "{} loves {}".format(treehouse, name)
or
email_greeting = treehouse + " loves " + name
Ann Cascarano
17,191 PointsTry ending your quotation marks before calling the format method, like this:
email_greeting = "{} loves {}".format(treehouse, name)
Kenneth Love
Treehouse Guest TeacherAs 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.