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 (2015) Python Data Types String concatenation

Adeyemi Lawal
Adeyemi Lawal
988 Points

name = 'yemmey' subject ="Treehouse loves" + name. Why is the above answer not correct according to the work space?

OK! Make a new variable named subject that concatenates (uses the + sign) the string "Treehouse loves" and your name var

strings.py
name = 'yemmey'
subject ="Treehouse loves" + name

3 Answers

Ari Misha
Ari Misha
19,323 Points

Hiya Randy! I agree! But notice the detail in the challenge which says concat name variable with "Treehouse loves"(see without space). Thats why i added an extra space to the string concat. In real world problem, i'd never do that. I did it , just for the sake of the challenge. Thats it! But your way is a correct way as well. (:

Right and

"Treehouse love " + name

is still concatenated ;)

Adeyemi Lawal
Adeyemi Lawal
988 Points

Thanks @Ari and @Randy

Ari Misha
Ari Misha
19,323 Points

Hiya Adeyemi! Looks like you missed space between "Treehouse loves" string and "name" variable. Your code should look like this:

name = "yemmy"
subject = "Treehouse loves" +  " " + name

You really should just add a space after loves and not do a + " " +