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

"X loves Y" but with treehouse for X and name for Y. Don't forget your spacing! How to solve this?

When assigning values you can assign strings, integers, and floats. Using the print function I can combine variables and strings. But nothing I've done has worked.

name = "Dennis"
tree = "Tree"
house = "house"
treehouse = tree + house
loves = " loves "
stop = "."
email_greeting = name + loves + treehouse + stop
Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hi Dennis, I have edited your question for readability.

You may want to have a quick read here for future reference on how to post on the forum: https://teamtreehouse.com/forum/posting-code-to-the-forum

;) Vittorio

1 Answer

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hey Dennis.

I think you did ok till the treehouse variable line. For the last task (3/3) I would suggest that you do it in a single line.

You will need to create email_greeting (like you did) and set it equal to a string. INSIDE the string you can put placeholders like this: {} This would then give you the chance of being able (at the end of the string) to add .format() passing in the variables you want to use in the string.

For example:

name = "Vittorio"
job = "moderator"

job_string = "{} is a {}".format(name, job)

job_string would be "Vittorio is a moderator"

Hope this helps you!Let me know.

Vittorio

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hey Dennis.

You are very close but the string needs to be "Treehouse loves Dennis" and not "Dennis loves Treehouse"!

I think you can get what is wrong by yourself! ;)

Vittorio

Thank you, solved:)