Help with Hold the forest pass

Hello I need help to pas this level “Hold the forest pass” This is my code # Use flags to join the battle or retreat.

If you fail, press Submit again for new random enemies and try again!

You’ll want at least 300 health, if not more.

loop:
enemy = self.findNearestEnemy()
flag = self.findFlag()
if flag:
# Pick up the flag.
pass
self.pickUpFlag(flag)
elif enemy:
# Fight!
pass
self.attack(enemy)
self.attack(enemy)
self.attack(enemy)
self.attack(enemy)
flag = self.findFlag(“green”)
pass
self.pickUpFlag(flag)

  1. Format your code by surrounding it with 3 backquotes (top left on your keyboard)

code here

  1. Remove the pass instructions in your code. They are put because and if or an elif require at least an instruction after.

  2. Delete the last 3 lines related to the flag: you already have a flag handling code at the begining

  3. Keep only one attack instruction. After the hero attack, a new loop cycle will be executed, and the hero will keep attacking. No point of having more than one attack per loop.

  4. The level is won using flags and at least 400 armor. Run towards enemies until they keep attacking you. Then lead them back to your archers for a wipe-out.

"loop:
enemy = self.findNearestEnemy()
flag = self.findFlag()
if flag:

Pick up the flag.

pass
self.pickUpFlag(flag)
elif enemy:

Fight!

pass
self.attack(enemy)
self.attack(enemy)
self.attack(enemy)
self.attack(enemy)
flag = self.findFlag(“green”)
pass
self.pickUpFlag(flag)"