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 trialJustin Ricke
Courses Plus Student 345 PointsNot sure what I am doing wrong ? name = "Justin" subject = "Treehouse loves {}" print(subject.format(name))
I thought this code wa formatted correctly but I am getting an error
name = "Justin"
subject = "Treehouse loves {}"
print(subject.format(name))
3 Answers
Dan Garrison
22,457 PointsThe format() should come immediately after your subject variable.
So it should look like:
subject = "Treehouse loves {}".format(name)
When you print this, the format method inserts the name variable into the brackets
Steven Parker
231,248 PointsYou don't print anything for this challenge.
You just do the formatting as part of the assignment of the variable subject.
I'm betting you can do it now without an explicit spoiler.
Justin Ricke
Courses Plus Student 345 PointsThanks for your help!