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

Robert Mckay
Robert Mckay
11,089 Points

working on a practice modal and keep getting an error. checked on my local machine with identical code it works.

keep getting an error in the test environment works fine on my local machine.

name.py
name = "Ernest"
treehouse = ("Tree"+"house")
email_greeting = (name +" loves " + treehouse)

2 Answers

You're definitely using the correct code to make a string! But look at the question again:

"create a new variable named email_greeting that puts the treehouse variable and the name variable into the sentence "X loves Y" but with treehouse for X and name for Y."

Are your treehouse and name variables in the right place?

I recommend using the print() command when using "local machines" For example:

name = "Ernest"
treehouse = ("Tree"+"house")
email_greeting = (name +" loves " + treehouse)
print (email_greeting)

That way it will show you what the "test environment" will be getting as its answer and you can check it against the question. (I do this often when I'm stuck with this kind of challenge)

As for your code it has the, you night want to swap "name" and "treehouse" around in this line of code:

email_greeting = (name +" loves " + treehouse)

PS: If using print() in "local machines" you might also want to use "import time" at the start and "time.sleep(5)" ("(5)" makes it wait 5 secs, can be replaced with (10) to make it last longer.) after print() so you have enough time to read the printed awnser before the program closes.

import time #put up with other imports
time.sleep(5) #put after the "print()" command 

PSS: I only know that amount about the "import time" and "time.sleep(5)" as i only found out how to use it to delay my programs from closing.