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 trialDebdipta Dasgupta
431 Pointscan't understand where am I going wrong. Tried a lot but couldn't crack the challenge Would appreciate a little help
I used the same code challenge in Treehouse Workspce and solved it.But somehow its not getting solved in the code challenge.Am I using the format method incorrectly?Couldn't understand.Need Help
name="Deb"
goal="Treehouse loves {}"
subject=(goal.format(name))
2 Answers
Gianmarco Mazzoran
22,076 PointsHi,
probably you can pass the challenge removing the external parenthesis in the variable subject
.
Anyway, it's not necessary store the string Treehouse loves {}
in a variable so you can do:
name = "Deb"
subject = "Treehouse loves {}".format(name)
EDIT: your code pass if you remove the external parenthesis in the in the variable subject
.
name = "Deb"
goal = "Treehouse loves {}"
subject = goal.format(name) # removed parenthesis
Chris Freeman
Treehouse Moderator 68,441 PointsThis challenge checker is specifically looking for the format
method being used directly on the patterned string:
name = "Deb"
subject = "Treehouse loves {}".format(name) # on same line
Debdipta Dasgupta
431 PointsThank you very much
Debdipta Dasgupta
431 PointsDebdipta Dasgupta
431 PointsThank you very much.Appreciate your help