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 trialJamaru Rodgers
3,046 PointsCode Challenge Broken!!
While formatting this bit of code, I've gone back many times and even taken pics of the video before this code challenge to make sure I'm not making an error. I also ran this same syntax in the python 3 shell on my computer and it worked, so I know its not me. What do I do, Treehouse??
name = "jamal"
subject = "Treehouse loves {}"
print(subject.format(name))
3 Answers
Jason Anders
Treehouse Moderator 145,860 PointsHey Jamal,
While your code may work in the shell, it is not what the challenge asked you to do. So, the challenge isn't broken. Your answer just isn't the correct one the challenge wants.
It didn't ask for a print
statement. So that needs to be deleted. It just asks you to use format method
on the string to make the string ... and assign it the the subject
variable.
The corrected code will only be two lines:
name = "Jamal"
subject = "Treehouse loves {}".format(name)
Keep Coding! And remember, the challenges and very specific and very strict.
Jennifer Nordell
Treehouse TeacherYou're close here! It wants the formatted string assigned to the variable subject. The entire string. We do this in one line of code. Take a look at what it's looking for. The challenge isn't broken.
name = "jamal"
subject = "Treehouse loves {}".format(name)
Jason Anders
Treehouse Moderator 145,860 PointsJennifer Nordell You beat me on the last one, though. Lol.
jcorum
71,830 PointsAlmost. But they didn't ask you to print. Just to reassign the formatted result back to subject:
name = "jamal"
subject = "Treehouse loves {}".format(name)
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse Teacher@jason anders You beat me to it again! :)
Jamaru Rodgers
3,046 PointsJamaru Rodgers
3,046 PointsThanks to all of you for responding, and I do apologize. I will try this again lol!!