1
I’m new to python and started with classes now, tried to start a class
but for some reason always gives error, the error changes but always gives, at the moment I am with the code this way :
class Inimigo:
def __init__(self, vida):
self.vida = vida
def ataque(self):
self.vida -= 2
inimigo1 = Inimigo()
However the error that returns is :
__init__() missing 1 required positional argument: 'vida'
I don’t understand, using the self.life = life no longer initializes life? And another if I want life to begin as a value defined as I must do?
self.vida = vida = 10
or
def __init__(self, vida = 10):
self.vida = vida