Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!