[Solved]Salvern sentry python HELP

while True:

flagGreen = self.findFlag("green")
flagBlack = self.findFlag("black")
hero.findFlag()
if flagGreen:  
    hero.pickUpFlag("green")
    hero.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y)
if flagBlack:
    hero.pickUpFlag("black")
    hero.buildXY("fence", flagBlack.pos.x, flagBlack.pos.y)
else:
    hero.moveXY(43, 31)

whats wrong with it help please

You should pick up the flags after you have built the fence or fire-trap

the first time i put a green flag it works but then it says that green flag is undefined
code:
while True:

flagGreen = self.findFlag("green")
flagBlack = self.findFlag("black")
hero.findFlag()
if flagGreen:  
    hero.buildXY("fence", flagGreen.pos.x, flagGreen.pos.y)
    hero.pickUpFlag("green")
if flagBlack:
    hero.buildXY("fence", flagBlack.pos.x, flagBlack.pos.y)
    hero.pickUpFlag("black")
else:
    hero.moveXY(43, 31)

You use self what means that you copied your code from someone else. Try to make your own code and then we will try to help you with the code.

its my brothers code we are both stuck on this level only i have a account and he doesn’t but yah let my try to make a other code

i made a other code and it worked i said green/black when i was sopost to say flagGreen/flagBlack

Please don’t post solutions!

my bad i wont do it again

there i took out the code

flag black is for fire-traps dude
and it is

hero.findFlag('black')
hero.findFlag('green')

hope dis helps

i said flagGreen/flagBlack with a slash