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

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

i tried all possibilities such as subject = "Treehouse loves" + name subject += name

strings.py
name = "Vijay"

2 Answers

Robert Lyon
Robert Lyon
7,551 Points

It doesn't actually make this clear in the wording of the challenge but you have to add a space after the word "loves" in "Treehouse loves" for the exercise to be accepted. e.g.

name = "Robert"
subject = "Treehouse loves " + name

The challenge is very picky when it comes to spacing- make sure that you leave a space after the word 'loves' before you type your last quote mark; like this:

name = "Your name"
subject = "Treehouse loves " + name  #notice the space after the word loves