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

concatenates?

what's the answer

strings.py
name = "Michelle"
subject = ("Treehouse loves"  +  {name})
Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Subsequent Questions (x2) regarding this thread have been deleted. Please do not post repeat questions regarding the same topic / challenge. Continue any subsequent follow-ups within the same thread as originally started. Multiple threads clutter the Community and cause confusion among others.

Thank-you

Jason ~Treehouse Community Moderator

1 Answer

andren
andren
28,558 Points

There are three issues:

  1. You aren't supposed to wrap variable names in curly braces {}.

  2. When you concatenate strings they are merged without any spacing added. So "Treehouse loves" + name results in "Treehouse lovesMichelle". In order to get a properly spaced string you have to add a space manually.

  3. You don't need to use parenthesis () when you assign a value.

If you fix those three issues like this:

name = "Michelle"
subject = "Treehouse loves " + name

Then your code will work.