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

In Python Basics challenge task 2 of 2 string-concatenation

QUESTION:OK! Make a new variable named subject that concatenates (uses the + sign) the string "Treehouse loves" and your name variable. You've probably received an email or two with this subject already!

(question before was make a variable named name and use your name so i did name = "kevin" and got it right)

now i have: name = "kevin" subject = "Treehouse loves" + "name"

i get -> Bummer! Remember that using + means your strings need extra spaces.

can someone show me the correct answer and explain to me if possible, help would be greatly appreciated, thanks!

4 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,468 Points

The missing space is needed after loves:

name = "kevin"
# added space after loves
subject = "Treehouse loves " + name

Edit: removed quotes from name

so i tried that and now i get this error

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

i didn't make any changes to name = "kevin" line and i have it typed exactly like how you have it above excluding .# <-- space after loves

I did not include the period and still got the Oops! It looks like Task 1 is no longer passing. message

Challenge Task 1 of 2

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?

name = 'Ary'

Challenge Task 2 of 2

OK! Make a new variable named subject that concatenates (uses the + sign) the string "Treehouse loves" and your name variable. You've probably received an email or two with this subject already!

subject = "Treehouse loves " + name

"Treehouse loves {}" .format ("name") subject = "Treehouse loves {}" + "name" }does'nt work.{ subject = "Treehouse loves " + name }does'nt work.{

Hmmmm...

Subject = "Treehouse loves " + name

Try that !!! It worked for me =)

I tried what you wrote Ancil Castillo and it still does not work

Chris Freeman
Chris Freeman
Treehouse Moderator 68,468 Points

Loren, I suggest creating a new post showing your code. Cutting and pasting other solutions may get you past the current challenge but it misses getting to know why your code is failing. It is the "I see what was wrong with my approach" learning is the most powerful and it propels you forward.

Tag me it the new post if you wish. Good luck!