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 Python Basics (2015) Python Data Types String concatenation

please 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

strings.py
name = "Kim"
subject = "Treehouse Loves"
print "subject" + "name+

2 Answers

Ben Reynolds
Ben Reynolds
35,170 Points

A 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"

Hi Ben, Thanks for the advice it is much appreciated.