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

subject = "Treehouse loves, name" name has been defined has "Shaun" a string variable how do I do this properly?

I've defined name = "Shaun" subject = "Treehouse loves + name" subject = "Treehouse loves" + name

neither of these work

strings.py
name = "Shaun"
subject = "Treehouse loves, name"

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

It wants you to use string concatenation. It doesn't understand in this context (without interpolation which comes later) that the name in your string is referencing your variable. So it's going to print out very literally what's inside those quots character for character. The challenge wants you to use concatenation, so take a look at how we do this.

name = "Shaun"
subject = "Treehouse loves " + name

Here we assign the variable subject "Treehouse loves " and then tack the name string onto the end. Note the trailing space after "Treehouse loves ". If we don't include this, our resulting string will be "Treehouse lovesShaun". So make sure to include the space otherwise the challenge will fail. Hope this helps!

I got it, and did it but I get an error

Oops! It looks like Task 1 is no longer passing.

Then it gives me some other weird error,

Done figured it out thank you so much =)