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 trialKennedy Otwenyo
785 PointsHi, please help me in understanding the question because I still get the wrong answer:
Q: OK, now use .format() on the string "Treehouse loves {}" to put your name into the placeholder. Assign this to the variable subject (so start with subject =). A:subject=('Treehouse loves{}'.format(' Ken'))
subject=('Treehouse loves{}'.format(' Ken'))
3 Answers
Alexander Davison
65,469 PointsAlso, you are missing a space between the {}
and the 'Treehouse loves' part. The string should look like this: 'Treehouse loves {}'
Chris Freeman
Treehouse Moderator 68,441 PointsThe challenge asked for the variable "name". You have used "subject".
Additionally, while this will pass, the outermost parens are not needed surrounding the string format.
Kennedy Otwenyo
785 PointsThank you guys, I sorted out the spacing before the '{}' and it ran successfully but the other insights are highly valuable too.
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsThat too. However, it is "covered" by the preceding space in the
format
argument.Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsOh...
Another note to Kennedy Otwenyo: You should be formatting in the
name
variable. The entire purpose of variables is to store information, and you can use the variable's name (in this casename
) to receive the value of that variable.Maybe it isn't required for the challenge, but it is recommended