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 Types and Branching Strings

mohan Abdul
PLUS
mohan Abdul
Courses Plus Student 1,453 Points

how do you join combine two variable labels together like it did in the task. I have been trying to do it on tree house

work space.

1 Answer

rydavim
rydavim
18,813 Points

Are you referring to the first question, which concatenates strings?

action = "got" # saves the string 'got' to the action variable
exclamation = "You " + action # creates a string variable called exclamation and combines 'You ' and action (which has a value of 'got')
exclamation += " this!" # += is short-hand for setting something to it's current value, plus whatever you're adding - in this case, the string ' this!'
print(exclamation) # print out the current value of exclamation, after all the code above has been executed

Hopefully that answers your question, but if that isn't the quiz you're referring to or if you have any follow-up, let me know and I'll be happy to help. If you need assistance with something you're working on in workspaces, please post a snapshot using the camera icon towards the top-right of the workspace. Happy coding!