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!
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

Arunava Mukherjee
1,420 Pointshelp me in task 3 of string formatting
Please help me in this code. I am stuck.
name = "Arunava"
treehouse = "Tree"+"house"
name = "y"
treehouse = "x"
email_greeting = treehouse+ " loves " +y
print email_greeting
3 Answers

Luke Glazebrook
13,564 PointsHey!
If I remember the task correctly then the output is supposed to be the other way round! Also when you are setting your variables to "x" and "y" you are actually overwriting the previous values of the variables which in this case you are not supposed to do. Similarly you are using an incorrect variable in the output!
This may be a lot to take in at this one time but just keep working on it and you will get there!
In the meantime I implement my code below to give you a head start on fixing these bugs!
email_greeting = name + " loves " + treehouse
-Luke

Caleb Kleveter
Treehouse Moderator 37,862 PointsHere is what it should look like:
Task 1
name = "Caleb"
Task 2
treehouse = "Tree" + "house"
Task 3
email_greeting = treehouse + " loves " + name

Arunava Mukherjee
1,420 PointsThanks Caleb. Got it! :)

Nitin George Cherian
4,410 PointsThere is a much cleaner way by using the format() function.
email_greeting = "{} loves {}".format(treehouse, name)
Arunava Mukherjee
1,420 PointsArunava Mukherjee
1,420 PointsThanks a lot Luke. Actually got a bit confused with x & y. Got it cleared and am good to go.