I 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 FreemanTreehouse Moderator 59,730 Points
Be 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!!!
Oh yes, I do remember that being in there now. Thank you!