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 trialAyaz Alam
339 PointsNeed Help!
What's wrong with the my attached code
name = "Ayaz"
subject ="Treehouse loves "
subject + name
3 Answers
Cindy Lea
Courses Plus Student 6,497 PointsYou need to concatenate the strings: You didnt do it correctly:
subject = "Treehouse loves " + name
Karen Freeman-Smith
29,248 Points"subject+name" would work in real life... but sometimes the tests are looking for a more specific way of solving the problem, it depends on the course how picky they are about writing the code they are looking for or just getting the right answer at the end
Jennifer Nordell
Treehouse TeacherAyaz Alam There's a couple of problems. Now you could have done it like this:
name = "Ayaz"
subject ="Treehouse loves "
subject = subject + name
That would have set the variable subject to the correct string. It wants subject to be equal to "Treehouse loves Ayaz". However, even though that would work outside the challenge. It doesn't work inside the challenge. Keep in mind that challenges are super picky.
So Cindy Lea is correct. To pass the challenge the string assignment to subject must be done all on one line.
name = "Ayaz"
subject ="Treehouse loves " + name
Happy coding!
Ayaz Alam
339 PointsAyaz Alam
339 Pointswhat is the problem in "subject + name" ?