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 trialWILLIAM GILLILAND
1,393 PointsOK, so now use .format() on the string "Treehouse loves {}" to put your name into the placeholder. Assign this to the va
ok
name="Bill"
subject.format("Treehouse loves {name} ")
2 Answers
Steven Parker
231,248 PointsHere are a few hints:
- when assigning, the variable name goes on the left, followed by an equal-sign ("
=
"), then the value - the format method should be applied directly to the string being formatted (not the one being assigned)
- the format method takes the value(s) being substituted into the string as the argument(s)
- the format string given by the challenge should be used as-is
Ammar Fatihallah
7,417 PointsYou need to set a string before you use the format, and you have a typo.
Your code should look something like this:
name = "Bill"
my_str = "Treehouse loves {}".format(name)
I hope this clears things out :)