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 trialJason Martino
1,573 PointsNameError: name 'subject' is not defined
I am not sure what I am doing wrong here. I have tried the same code with str() instead of print as well
name = "Jason Martino"
print("Treehouse loves {}".format("name"))
2 Answers
Jennifer Nordell
Treehouse TeacherThe challenge explicitly states that you need to assign the string to the variable named subject. We do this with the following code. Remember, keep your name variable as is.
subject = "Treehouse loves {}".format(name)
Kourosh Raeen
23,733 PointsYou should pass the name variable to format() without quotes. Also, instead of displaying the string you need to assign it to a variable named subject:
name = "Jason Martino"
subject = "Treehouse loves {}".format(name)
Jason Martino
1,573 PointsJason Martino
1,573 PointsThank you Jennifer!