Sarven Shepherd Python Help Solved

For some reason my hero wont attack.

loop:

enemies = self.findEnemies()
enemyIndex = 0

# Wrap this logic in a while loop to attack all enemies.
while enemyIndex < len(enemies):
enemy = enemies[enemyIndex]
# “!=” means "not equal to."
if enemy.type != “sand-yak”:
# While the enemy’s health is greater than 0, attack it!
while enemy.health > 0:
self.attack(enemy)
enemyIndex += 1

# Between waves, move back to the center
self.moveXY(39, 32)

For someone who joined almost a month ago, one would think that they would have read the FAQ and learned how to format your code properly. Please do so, then we will examine your code.

My dad helped me fix it I read the FAQ but I couldn’t find anything on formatting please show me

In the FAQ, there is a section called Post your code with radiant, harmonious formatting in bold. This section is in the section I need help with my code!