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 don't understand string

string???

strings.py
name = "Deja vu"
subject = "Treehouse loves"
"name_" + "subject"

1 Answer

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

Ok, first off let me clarify the "Deja vu" thing. It's just an expression that English speakers have taken from French that means roughly "seen/done this before".

Secondly, string is just a fancy way of saying a series of characters. In your code "Deja vu" is a string and so is "Treehouse loves". We denote a string by setting them inside quotation marks.

Here's the code it's looking for:

name = "Jane"
subject = "Treehouse loves " + name

Here I've set the name to Jane. Now I've made a new variable named subject which will contain the the value "Treehouse loves Jane". We are using string concatenation here. It takes "Treehouse loves " and "Jane" and smushes them together. That whole thing is now assigned to the variable subject.

Hope that helps! Happy coding!