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

I cant get "treehouse" to be "x" and "Tree"+"house". Please help.

name = "Maxim"
treehouse = "Tree"+"house"
name = "y"
treehouse = "x"
email_greting = "x"+"loves"+"y"

4 Answers

When you assign name ="y" you are saying to python

--Hey Python, I want a variable called name to be equal to "y"

So in your final instruction you are saying

-- Hey Python, I want a variable calle email_greting (you probably wanted email_greEting) to be equal to "x"+"loves"+"y", which is "xlovesy"

Remember that what ever you put inside these " " is a string Value not a variable

Hi Max,

Where you have gone wrong is in lines 3, 4 and 5 where I believe you have gotten strings and variables mixed up. Strings are values within quotation marks (like this: "x"). Variables are stores of value and are represented with a name [like this: x (without the quotation marks)]

In lines 3 & 4, you have assigned the variables name and treehouse with the string values of "x" and "y" instead of assigning them to a new set of variables which you'd use in line 5. Hence, if name = x, and name = "Maxim", then the value of the variable x is "Maxim".

In line 5, your variable 'email_greeting' is essentially a concatenation of the strings "x", "loves" and "y". You should replace the strings "x" and "y" with the variables x and y which contain the string values, "Maxim" and "Treehouse".

So:

x + "loves" + y = "Maximlovestreehouse"

But wait! That's not the right answer! To correct this you need to add space within the quotation marks before and after the word loves, like this: " loves "

Hope this helps!

Stephen Bone
Stephen Bone
12,359 Points

Yeah to continue on from what Miguel has said. You're basically setting the name and treehouse variables correctly and then resetting them to be equal to x and y. What it wants you to do is put in the values you set in the previous steps in positions x and y. To give you a hint which will hopefully make sense, the way I did this one was using the string formatting method demonstrated in the previous video.

Hope that helps but if you have any further questions I'll try to help you out.

you don't make the variables x and y you just put where it tells you to in the question. name = "bob"
treehouse = "Tree" + "house" email_greeting = treehouse + " loves " + name