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

Please help!

Please help! I am new to programming and I am having difficulty with this seemingly simple problem. I feel that I must be missing something obvious.

name.py
name = "Paul"
treehouse = "Tree" + "house"
email_greeting = "treehouse" + "loves" + "name"

This is the problem: "Finally, create a new variable named email_greeting that puts the treehouse variable and the name variable into the sentence "X loves Y" but with treehouse for X and name for Y. Don't forget your spacing!"

3 Answers

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Paul;

Welcome to Treehouse!

In your email_greeting variable you are not using your name or treehouse variables. You are using strings and have not added the requested spaces. Your code is currently returning:

treehouselovesname

Do you recall from the video how to concatenate strings together?

Happy coding,

Ken

Hi Paul

you have stored the your string values in variables called name and treehouse. Your problem is instead of concatenating your variables treehouse and name to the email_greeting variable you are concatenating two strings names "treehouse" and "name".

I personally always like to use the format method of the string class where you substitute your values for the {} like this.

name = "Paul"
treehouse = "Tree" + "house" 
email_greeting = "{} loves {}".format(treehouse,name)

Great, thanks for the help!