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 trialCheri Castro
226 PointsStill wrong, on challenge task 2 of 2.
I've tried several variations and watched the video. Somewhere I'm just not getting it. It just like in the other part of challenge task 2 of 2, it tells me that part one is right and the then it comes back and tells me that part one is wrong, after I've completed part two. The instructions say we don't need to print anything so I tried it with and without the print, both came up as now step one is wrong. I guess I am just not understanding the videos well enough.Which is the same problem that I am having in my college class, that's why I started with treehouse because I'm struggling with my programming and logic but only with Python, not with Raptor.
name="Cheri"
subject="Treehouse loves {} "
print(subject.format(Cheri))
subject=("Treehouse loves {}".format)
5 Answers
Daniel Marin
8,021 PointsIt's because you have a space after the right bracket ("{} ").
Remove that space and you're good to go:
"Treehouse loves {} ".format(name)
it needs to be like this without the space:
subject= "Treehouse loves {}".format(name)
Daniel Marin
8,021 PointsHi,
So when you create subject you can use format to replace {} to the name variable.
This is how you can do it:
name="Cheri"
subject= "Treehouse loves {}".format(name)
Check python docs:https://docs.python.org/2/library/string.html#format-examples
Cheri Castro
226 PointsOk, so the video makes it seem as if the .format() needs to be placed on it's own line, rather than just state what you want formatted right in the same line but I guess, by your explanation that's not the case.?
Cheri Castro
226 PointsI tried what you suggested, subject="Treehouse loves {} ".format(name) ,but it's still coming back as wrong, with this as the error - Bummer! Be sure to use the {}
placeholder and the .format()
method. So, I tried subject=("Treehouse loves {} ".format(name)) but that was a no go also. I reviewed the section of the link that you included but nothing is standing out to me. Thank you for your advice.
Cheri Castro
226 PointsThank you.