I don't know how to fix it but I think my code is clear. I am a beginner level python learner.
Here, I made a class Hero
that has the method attack
. However, when I called the method it says, there is an error 'int' object is not callable.
class Hero(object):
def __init__(self, name, hp, att_pwr, def_pwr ):
self.name = name
self.health = hp
self.attack = att_pwr
self.defense = def_pwr
def attack(self):
print(self.name + ' is attacking')
Hero1 = Hero('Arif', 75, 50, 40)
Hero1.attack()