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

Antonio Velardo
Antonio Velardo
Courses Plus Student 111 Points

create a variable names Tree and house? name = "Antonio" 3 = "Tree" 4 = House print 3 and 4

it gives me a bummer syntax Error

name = "Antonio"
3 = "Tree"
4 = House
print 3 and 4 

Could you please include the syntax error?

3 Answers

Hello Antonio,

I am not familiar with python but looking at this I suspect there are a few issues:

  • You cannot use numbers as variable names (e.g. 3 and 4)

  • House is not surrounded by quotes

  • The syntax you are using to print is incorrect. Any strings need to be surrounded with " ". If you want the output of a variable to be added to a larger string, you will need to add +.

name = "Antonio"
plant = "Tree"
shelter = "house"

print plant + shelter + " loves " + name + "."
# "Treehouse loves Antonio."



Isaac Calvo
Isaac Calvo
8,882 Points
name = 'my name'
treehouse = "Tree" + "house"
email_greeting = treehouse + " " + "loves" + " " + name

cant use numbers at the beginning of a variable name in python. 1 = 'one' will fail but one1 = 'one' works. Also anytime you use a string it has to be surrounded by quotes.

Antonio Velardo
Antonio Velardo
Courses Plus Student 111 Points

thanks isaac

i dont understand the need to splitting "treehouse" in 2 string, what the exercise was trying to suggest? i am referring to the python lesson on string , and the quiz i would i execute the two string?print "tree" + house ?

The reason "treehouse" has been split into two words is to show how variables can be concatenated together.