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 trialOliver Guevarra
918 PointsString Formatting Help
Having trouble with the string formatting objective.
I've entered this code,
name = "My Name" subject = "Treehouse loves {}".format(name)
When I check my work its telling me the code is wrong.
1 Answer
Sean Manners
14,816 PointsHi there!
Your code is actually perfect. The only thing you'll need to adjust, if I'm right that your code is exactly as you've put it above, is where you define the subject and the name. You can't do both on the same line, so you'd have to make it:
name = "My Name"
subject = "Treehouse loves {}".format(name)
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsActually, he didn't_put it on the same line. It's just the Treehouse community posts automatically deletes newlines, so you need to use two newlines to tell the output to actually put a newline.
Like this. Also, in my post box at this moment when I'm typing this, I actually put one newline after the "Like this" message but this newline will be deleted.