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 (Retired) Ins & Outs Ins & Outs

Combining variables does not work

name1 = "Tree" name2 = "house"

print("{}{}".format(name1,name2))

This code works on the "Workspace" but it does not work on the "Challenge Terminal"

name.py

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

That isn't combining the variables, though. That's printing a string that has both variables' content in it.

You need to make a new variable by combining those two variables or just the strings.

The reason this code works on workspaces, is because it is valid code; however, the problem is, this isn't combining the strings as the problems asks you to do.

What you're doing is having two variables and printing them to the console side by side. What the problem wants you to do is create a separate variable that has the string "tree" and "house" put together