Problem in Code

Hi, my name is Samarth and I am 13 years old… I had a doubt in the ‘Mind The Trap’ level in Backwoods Forest…can someone help me ??
My code :
while True:
flag = hero.findFlag()
enemy = hero.findNearestEnemy()

if flag:
    # Pick up the flag.
    hero.pickUpFlag(flag)
    hero.say("I should pick up the flag.")
elif enemy:
    # Only attack if the enemy distance is < 10 meters
    if hero.distanceTo(enemy) < 10:
        hero.attack(enemy)

can someone pls help me ??

sorry…I tried it once again…and i got it…thanks !!

1 Like

Sorry I couldn’t answer, glad you fixed it though.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.