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 trialABO ALI
279 PointsHi I had test my answer in python shell and it is wok correctly But in the quiz dos't , when I click Recheck!!! why?
I had do the seam steps in python shell and I get this result
>>> treehouse loves khaled
But in this Challenge task I get error message although I do the same script , What is the different and problem?
name = "{}"
subject = "Treehouse loves "+name.format("khaled")
print(subject)
1 Answer
Ryan S
27,276 PointsHi Abo,
Yes your code will work fine in the Python shell and is a perfectly legitimate way of doing things, but the problem is you are going a bit out of bounds with what the challenge is asking.
First, you originally defined your name as "{}" in task 1.
So when the challenge checker is looking for your concatenated string in task 2, it is expecting to find "Treehouse loves {}".
But by using the .format() method, you've now substituted something different for your name. So now the challenge will find "Treehouse loves khaled" and won't pass because name is still defined as "{}".
Also, you don't need to print(subject) in the challenge. It is just looking for the subject variable to be defined.
Good luck.