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 trialGaurav Sharma
Courses Plus Student 964 Pointschallenge task 2.2 is failing
below code command: name="Gaurav sharma" subject="treehouse loves {}" print(subject.format(str(name))) is working fine in workspace, but throwing error in quiz. Not sure if i got the wrong understanding of question. But also when i tried to print as "print(subject.format(name)) in workspace that also failed. Thanks for your time, Happy coding :)
name= "gaurav sharma"
subject= "Treehouse loves {}"
print(subject.format(str(name)))
2 Answers
Rolando Aguilera
4,662 Pointsname= "gaurav sharma" subject= "Treehouse loves {}".format(name)
That will be enough to complete the challenge! Keep coding!!
james south
Front End Web Development Techdegree Graduate 33,271 Pointsthe challenge does not ask you to print anything. use the format method in the same line where you initialize subject, but without the str, name is already a string, it doesn't need to be cast as such.
Gaurav Sharma
Courses Plus Student 964 Pointstried: name= "gaurav sharma" subject= "Treehouse loves.format(name)"
it is also failing. tried below as well which also failed: name= "gaurav sharma" subject= "Treehouse loves {}" print(subject.format(name))
Nakisha Bowles
Courses Plus Student 1,010 PointsNakisha Bowles
Courses Plus Student 1,010 PointsGaurav Sharma, were you able to get pass 2.2 using these codes? I am still having trouble. Can you please help?
Gaurav Sharma
Courses Plus Student 964 PointsGaurav Sharma
Courses Plus Student 964 Pointsthanks mate, it worked fine. i was almost there, made a silly mistake