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

bobcat
bobcat
13,623 Points

Am I going mad? Or just plain terrible at Python?

Cant work out what I am doing wrong?

name = ("Rob")

treehouse = ("Tree") + ("house")

email_greeting = treehouse + ("loves") + name
Kenneth Love
Kenneth Love
Treehouse Guest Teacher

The code you have is technically correct (Python treats single items in parentheses as just being that item), but your last line actually makes "TreehouselovesRob" instead of "Treehouse loves Rob", like it should.

4 Answers

Stone Preston
Stone Preston
42,016 Points

remove the ( ). you dont need to to put a parenthesis around each of your strings. you would need parenthesis on things like a call to the input function: input("your prompt here:"), but not just a regular string variable. I think that may be whats tripping you up.

all they need is quotes. and also put a space before and after loves so that it comes out as "Rob loves treehouse" and not "Roblovestreehouse"

you have the right idea, just need a few modifications

name = "Rob"

treehouse = "Tree" + "house"

email_greeting = treehouse + " loves " + name
bobcat
bobcat
13,623 Points

Thanks for the help Christopher!

bobcat
bobcat
13,623 Points

stone_preston = "Python" "Hero!"

Thanks!

Stone Preston
Stone Preston
42,016 Points

careful, dont forget your plus sign to concatenate those strings!

stone_preston = "Python" + " Hero!"

glad I could help : )

bobcat
bobcat
13,623 Points
print ("much lol that has made my night, thanks for the help bro!")