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 trialGroshvin Grover
327 PointsI need help with this Code Challenge
Ok, so I'm completely stuck on this code challenge. Any help would help be appreciated. Thank you.
name = "Kenneth"
subject = "Treehouse " + "loves"
print(subject + name)
1 Answer
Thayer Y
29,789 Pointsname = "Kenneth"
subject = "Treehouse " + "loves" # (uses the + sign) the string "Treehouse loves" and your name variable.
subject = "Treehouse loves " + name
print(subject + name) # there's no need to this line
Keifer Joedicker
5,869 PointsKeifer Joedicker
5,869 Pointssubject = "Treehouse " + "loves"
Instead of concatenating these two strings together inside of a variable just type them out the one time you need them.
subject = "Treehouse loves "
Assigning data to a variable is only practical when you may need to reference that data again.
Reading closer the instructions ask us to create a variable called "subject" and assign the concatenate of "Treehouse loves" and the name variable. In doing so we should have the following lines of code: