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 trialbobcat
13,623 PointsAm 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
4 Answers
Stone Preston
42,016 Pointsremove 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
Christopher Johnson
Python Web Development Techdegree Student 11,422 Points name = "Rob"
treehouse = "Tree" + "house"
email_greeting = "{} loves {}".format(treehouse, name)
Works as well :)
bobcat
13,623 PointsThanks for the help Christopher!
bobcat
13,623 Pointsstone_preston = "Python" "Hero!"
Thanks!
Stone Preston
42,016 Pointscareful, dont forget your plus sign to concatenate those strings!
stone_preston = "Python" + " Hero!"
glad I could help : )
bobcat
13,623 Pointsprint ("much lol that has made my night, thanks for the help bro!")
Kenneth Love
Treehouse Guest TeacherKenneth Love
Treehouse Guest TeacherThe 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.