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

I keep getting the "Remember that using `+` means your strings need extra spaces." error message?

I've tried putting spaces everywhere, in case they're looking for something specific. What I'm writing works in Workspaces so what I'm doing has to be right? Very confused please help

strings.py
subject = "Treehouse loves "
name = "Sierra"
subject + name

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Sierra,

You're on the right track and have all the pieces. They are just not quite in order, and you're not quite following exactly what the instructions are asking for. Tasks on Treehouse are very specific and very picky, so any deviation usually results in Bummer.

For the second task, it wants a second variable created (subject), which you have done, but it also wants the name variable concatenated onto it. This needs to be done all on one line. So, the final code will look like this:

name = "Sierra"
subject = "Treehouse loves " + name

Also, code needs to be added a certain way in most languages (Python is one of them). You have the code for task two on top of the code for task one. If you try to run the code you have (with the corrections) in the order you have here (or in the real world), it will throw an error that "name is not defined". This is because you are trying to use a variable that you have not defined yet... name isn't defined until the next line.

I hope this helps.
Keep up the good work and keep coding! :) :dizzy:

OHHH okay thank you so much!!!

Saran Davaa
Saran Davaa
403 Points

name = "Saran" subject = "Treehouse loves" + name

Why is this not working?

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Hi Saran,

It's always best to begin a new thread when you have a question. Older threads are quite often not monitored, so no one will know you are asking a question. Even when it is still monitored, only the person / people involved in the thread will receive your notification, so instead of everyone in the community who could help, you only get a few.

With that said, you are not putting a much needed space in your string. Right now your string will print out

Treehouse lovesSaran

Note the lack of a space between "Treehouse" and "Saran"
Just fix that up and it will pass.
Also, have a look at the Markdown Cheatsheet (hyperlink above the Post button) when posting code to the Community. Without Markdown, it can be difficult (and sometimes impossible) to read.

Keep coding! :) :dizzy: