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 trialKim Du Ross
246 Pointsplease help with challange task 2 of 2 in strings
Hello,
I am a bit stuck, can you please check out my code and let me know where I went wrong.
Many thanks
Kim
name = "Kim"
subject = "Treehouse Loves"
print "subject" + "name+
2 Answers
Ben Reynolds
35,170 PointsA value in quote marks is called a string literal, and will be printed exactly as it appears in the quotes. So if i have this code:
print("subject" + "name")
It will actually print "subject name". The variable names don't have to be in quotes, the strings they contain will be printed when the program runs. It should look similar to this:
var1 = "string 1"
var2 = "string 2"
print(var1 + var2)
# this will print "string 1 string 2"
Kim Du Ross
246 PointsHi Ben, Thanks for the advice it is much appreciated.