Not sure if this is a “bug”, but here is a problem:
(This is the instruction)
Use a while-true loop to both move and attack.
(And this is the winning code)
enemy = self.findNearestEnemy()
As you can see, there isn’t a while-true loop anywhere, just plain “loop”.