Shavern Shepard -Hero Stops attacking after defeating a few ogres

while True:
    enemies = hero.findEnemies()
    enemyIndex = 0
    while True:
        while enemyIndex < len(enemies):
            enemy = enemies[enemyIndex]
            if enemy.type != "sand-yak":
                while > 0:
            enemyIndex = enemyIndex + 1
            # Between waves, move back to the center.
    hero.moveXY(39, 32)
```I need help. My hero stops attacking after a few ogres. What is wrong with my code?

You don’t need a second while True: loop, you only need one of them, and a while enemyIndex loop
I think it works apart from that.

You are using too many while loop, this is why you dont see your error. There is 4 while loops in your code. The problem is with a variable.