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 trialDias Murzabekov
879 Pointserror message despite working code
This code is doing what it's supposed to , however I still get an error message...
name = "Dias" subject = "Treehouse loves {}" subject.format(name)
name = "Dias"
subject = "Treehose loves {}"
subject.format(name)
1 Answer
Steven Parker
231,236 PointsI'm wondering how you determine "doing what it's supposed to"? Be very careful about testing in an external REPL or sandbox tool. If you have misunderstood the challenge, it's also very likely that you will misinterpret the results.
In this case, the instructions said, "Assign this to the variable subject
(so start with subject =
)." So you know the last line must start with the word "subject" followed by an equal sign. And the format
method can be applied directly to the template string, you don't need a variable for it. Keep in mind that the "format" method does not change the string you apply it to but returns a new string after processing instead.
And finally, you wrote "Treehose" instead of "Treehouse". The challenges are very picky about literal strings.
Dias Murzabekov
879 PointsDias Murzabekov
879 PointsThank you so much for a detailed answer!