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 trialOleksiy Kloc
733 Pointsprint(subject.format(name)) should work but doesn't
Why not?
name = 'alex'
subject = 'Treehouse loves {}'
print(subject.format(name))
2 Answers
Michael Gallego
1,568 PointsI'm guessing because you aren't doing what the challenge wants you to do, which is just to use the plus sign to concatenate the string with your name value.
Oszkár Fehér
Treehouse Project ReviewerHello format() method it should be used when you have to insert something in a text, int, float, str, byte, even objects
'Treehouse loves {} student'
and in
format('your name')
as
'Treehouse loves {} student'.format('your name')
will look
'Treehouse loves your name student'.
With + you add to the end or the beginning of the string and just string!! NO integer or other types