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
Kevin Paras
2,277 PointsIn 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
Treehouse Moderator 68,468 PointsThe missing space is needed after loves:
name = "kevin"
# added space after loves
subject = "Treehouse loves " + name
Edit: removed quotes from name
Ary de Oliveira
Courses Plus Student 28,304 PointsChallenge 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
Nicholas Bowman
849 Points"Treehouse loves {}" .format ("name") subject = "Treehouse loves {}" + "name" }does'nt work.{ subject = "Treehouse loves " + name }does'nt work.{
Hmmmm...
Ancil Castillo
5,628 PointsSubject = "Treehouse loves " + name
Try that !!! It worked for me =)
Loren Moyer
306 PointsI tried what you wrote Ancil Castillo and it still does not work
Chris Freeman
Treehouse Moderator 68,468 PointsLoren, 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!
Kevin Paras
2,277 PointsKevin Paras
2,277 Pointsso 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
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsSorry a period was accidentally added.
Kevin Paras
2,277 PointsKevin Paras
2,277 PointsI did not include the period and still got the Oops! It looks like Task 1 is no longer passing. message
Chris Freeman
Treehouse Moderator 68,468 PointsChris Freeman
Treehouse Moderator 68,468 PointsCan you post your current code?