Yes, as zimmah has said, surround your code with backticks, which is the key directly above the Tab key. See the FAQ for more information. I have formatted your code for you this time, but please do so yourself in the future.
Two things:
You have not surrounded your code in a loop.
Also, your elif statements are indented by one space. This should not be.
# Use different colored flags to perform different tasks.
while True:
flagGreen = hero.findFlag("green")
flagBlack = hero.findFlag("black")
# If there's a flagGreen...
if flagGreen:
hero.moveXY(flagGreen, pos.x, flagBlack.pos.y)
# Build a "fence" at flagGreen's position.
hero.buildXY("fence", Xpos.x, Ypos.y)
# Pick up the flag!
hero.pickUpFlag(flag)
# If there's a flagBlack...
if flagBlack:
# Build a "fire-trap" at flagBlack's position.
# Pick up the flag!
# Move back to the center.
hero.moveXY(43, 31)
i dont know what to do .I cant understand.I cant keep on.why use (flagGreen, pos.x )as x and (flagBlack.pos.y) as y .
Try look through the hints on the top right corner before asking more questions.
If you have any more questions after reading the hints section feel free to tell us your issue