Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Brandon Lombardo
863 PointsI get <bound method Warrior.attack of <characters.Warrior object at 0x7faec4faa780>> when trying to run my methods.
Here is my code:
class Character:
def __init__(self, name, **kwargs):
self.name = name
for key, value in kwargs.items():
setattr(self, key, value)
class Warrior(Character):
courage = True
def attack(self):
return self.courage and bool(random.randint(0, 1))
def defend(self, shield_level):
return self.courage and shield_level > 4
I created a different character type but tried to do the exact equivalent of what Kenneth did. Any help would be appreciated. Thanks in advance!
[MOD: need to use ``` instead of ‘’’ in formatting -cf]

Chris Freeman
Treehouse Moderator 68,082 Pointsneed to use backtick ``` instead of quotation marks ’’’
in formatting -cf]
2 Answers

Chris Freeman
Treehouse Moderator 68,082 PointsBe sure you are calling the method by including parens: instance.attack()
verses referencing the method without parens.
Post back if you need more help. Good luck!!!

Brandon Lombardo
863 PointsThank you, Chris! I got defend to work now, but attack is having trouble with the name 'random' not being defined.

Chris Freeman
Treehouse Moderator 68,082 PointsBe sure to add at top of file:
import random

Brandon Lombardo
863 PointsOh yes, I do remember that being in there now. Thank you!
Brandon Lombardo
863 PointsBrandon Lombardo
863 PointsI also can't figure out why the character class won't show up as code.