Whenever I run this program, I can't get the while loop to repeat. It's a simple exercise with classes and I don't know what I am doing wrong.
class Enemy():
def attack(self):
enemy_health = 50
while enemy_health > 0:
action = input("attack enemy?")
if action.lower() == "yes":
print("enemy health dropped by 5")
enemy_health =- 5
else:
print("enemy escaped!")
jaguar = Enemy()
jaguar.attack()
I want the input to repeat until the enemy health is 0. Also, should I include any return statements in here instead of simply subtracting from enemy health? Thank you
enemy_health =- 5toenemy_health -= 5.enemy_health-=5orenemy_health=enemy_health-5