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

Help w/ python w/ this string activity.

I want you to help me make a string to use for an email greeting. To start, we need a variable named name that's assigned to your name. Deja vu, huh?

strings.py

2 Answers

AJ Salmon
AJ Salmon
5,675 Points

For task one, all you need to do is assign a string (ideally of your name) to the variable name. Remember, whenever you're making a new variable, the variable goes on the left side of the equal sign. Example:

>>> variable = 'string'

For Task Two, you need to concatenate the string "Treehouse loves" and your name variable, and assign that to the variable subject. Python knows that your name variable is actually a string, so when they're put together (with the + sign) it will read "Treehouse loves Brent". Example:

>>> food = 'tacos'
>>> subject = "I love " + food
>>> subject
>>> 'I love tacos'

Notice the space between the last word and the closing parenthesis. If this space wasn't there, there'd be no space between love and tacos. Make sure to include that space!

Hope this helps!

AJ

Thank you AJ!