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 trial

Python Object-Oriented Python (retired) Hack-n-Slash Warriors! Come Out and Play-ay!

Please help as I am stuck in Part 4

Could you help me solve the last part

warrior.py
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)

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi Mehran! You are so close here so I'm going to just give some hints.

  • You have indentation errors. The return statement for the string should be indented inside the str method.
  • They don't actually want you to print out the angle brackets. Those are shown as part of a placeholder.
  • The ending string returned should look something like "Warrior, axe, 13" :smiley:

Hope this helps! :sparkles:

Thanks for your answer. It almost made me crazy