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
Jason Ybarra
Courses Plus Student 206 PointsHi I could use little help plz
In the string concatenate for python I named my variable
name = "jason"
Next I was too add treehouse loves + name
I tried the following variations
name = "jason"
subject = "treehouse loves+ name"
# and
subject = "treehouse loves"
name += "treehouse loves"
# and
subject = "treehouse loves + jason"
I am having trouble understanding where I didn't do right. I could use help, I'm new to the python language.
[MOD: Added formatting -cf]
2 Answers
Chris Freeman
Treehouse Moderator 68,468 PointsYou are very close. The variable (and plus sign) are placed outside of the quote marks. Remember to include a space after "loves" so that you don't get "Treehouse lovesjason". Also "Treehouse" should be capitalized:
name = "jason"
subject = "Treehouse loves " + name
Todd MacIntyre
12,248 PointsHaving the + inside of the quotes makes it a part of the string itself, thus not allowing concatenation to take place. Placing the + outside of the quotes signals to python that you want to concatenate a string with a variable.