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

Nadia Balogou
Nadia Balogou
212 Points

I keep getting an error message saying that I need extra spaces when using + but not sure how to format it

I am supposed to concatenate 'treehouse loves' + 'name'

strings.py
name = 'Nadia'
subject = 'treehouse loves'   +    'name'

4 Answers

First issue is don't put quotes around name, thats a variable and you don't need quotes around it. Secondly add a space between loves and the ending quotation '.

What that does is instead of outputting:

treehouse lovesNadia

which your code currently does.

it'll output:

treehouse loves Nadia
Robert Lyon
Robert Lyon
7,551 Points

Try adding a space to the string. subject = 'Treehouse loves ' + 'name'

Nadia Balogou
Nadia Balogou
212 Points

Hi, I have tried adding spaces in different places but still running into the error message unfortunately.

Robert Lyon
Robert Lyon
7,551 Points

Just noticed you have quotes around the variable name aswell try removing those. subject = 'Treehouse loves ' + name