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

cant complete

Create a new class named Warrior that extends Character from character.py. Use pass to make an empty class.

Maybe you forgot to import the Character class from character.py?

from character import Character

class Warrior(Character):
    pass

3 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Can you show us the code you're trying so we can know where you need help?

Im having trouble with task 3 of this challenge :/

Make a new Warrior method called rage that sets attack_limit to 20.

from character import Character

class Warrior(Character):
  weapon = "sword"
  pass
Kenneth Love
Kenneth Love
Treehouse Guest Teacher

OK, what part has you confused? You need to add a method to the class. Methods are functions that are indented inside of a class. They take self as their first argument. Then, in that method, you need to change the instance's attack_limit to 20.

the istances

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

self always refers to the instance that the method is being called on.

Thnx. I get it :)