[Desert Combat] Stuck in a while loop?

I’ve tried a few different things on the second while loop. I keep getting the same error message.

I think it’s because of the returning value of findNearestEnemy.

Try something like this:

while ordersGiven>=5:
    enemy=self.findNearestEnemy
    #it should not ignore this check
    if enemy:
        self.attack(enemy)
    else:
        break

That didn’t work. I’m not sure what to do.

Outlash forgot some brackets.
Correct is

enemy = self.findNearestEnemy()