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 trialNathan Cha
1,695 Pointshow to?
name = "Nathan" subject = "Treehouse loves {}" print(subject.format(name))
name = "Nathan"
subject = "Treehouse loves {}"
print(subject.format(name))
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Nathan! Here's a tip:
Try not to (at least during challenges) do things the challenge doesn't specifically ask for. Even if functional outside the challenge, it can still cause the challenge to fail.
On to the problem. See those curly braces? We use the .format method on our string to tell it to put the value of a variable in that spot. So we want to immediately follow the string with the .format method. All on the same line. Take a look at my solution:
name = "Nathan"
subject = "Treehouse loves {}".format(name)
Happy coding!