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

how to combine "Tree " and "House" into a variable .

Seems really simple but I can't get it . I've watched the video a couple times. Still not sinking in..

name.py
name = 'jon'
var1="Tree"
var2="House"
treehouse=var1 + var2

1 Answer

kirkbyo
kirkbyo
15,791 Points

Hi Jon,

Instead of combining var1 and var2 you can simply just add the two string together at the time of creating the variable. For example

hello = "Hello" + "World" 

Your way will still get the job done, but the task won't accept that for some reason.

Hope this helped. If you have any other questions let me know,

Ozzie

EDIT:

Looks like I was wrong, the task will accept your code just instead of having a capital "H" when creating var2 change to a lowercase.

name = 'jon'
var1 = "Tree"
var2 = "house"
treehouse = var1 + var2

got it! thanks