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 trialBrian Anstett
5,831 PointsI've been having issue like this a lot. Any suggestions?
I've been getting problems like the following: Bummer! Expected " Warrior, axe, 40" and got "Warrior, axe, 40".
Or i will paste by code out side of the coding exercise and I get the correct results but when inside the environment I get errors.
from character import Character
class Warrior(Character):
weapon = "sword"
def rage(self):
self.attack_limit = 20
def __str__(self):
return "Warrior, {} , {}".format(self.weapon, self.attack_limit)
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! Challenges can be and very often are very picky. And you've just run into a prime example of this. Your logic is fine. Your code is fine. But the format of your string has an extra space. Seriously, that's the entire problem.
Many times the solution is in the Bummer message, but you have to look closely. Take another look:
Bummer! Expected "Warrior, axe, 40", got "Warrior, axe , 40".
See the extra space between "axe" and the following comma? There's your problem.
So this is the line you need:
return "Warrior, {}, {}".format(self.weapon, self.attack_limit)
Hope this helps!
Brian Anstett
5,831 PointsThank you Jennifer. I too have noticed how the coding challenges are picky. Going forward I will keep these things in mind.