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

Python Python Basics (Retired) Ins & Outs Ins & Outs

Arunava Mukherjee
Arunava Mukherjee
1,420 Points

help 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


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


Arunava Mukherjee
Arunava Mukherjee
1,420 Points

Thanks a lot Luke. Actually got a bit confused with x & y. Got it cleared and am good to go.

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

Here is what it should look like:

Task 1

name = "Caleb"

Task 2

treehouse = "Tree" + "house"

Task 3

email_greeting = treehouse + " loves " + name
Nitin George Cherian
Nitin George Cherian
4,410 Points

There is a much cleaner way by using the format() function.

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