Define inAttackRange - Problem Solved

Hi, could you please help me have a look that why my code is wrong? I was trying to define the inAttackRange.

Thanks a lot in advance for your help and look forward to your reply!

Try doing

def inAttackRange(enemy):
    enemy=hero.findNearestEnemy()
    if enemy:
        if help.distanceTo(enemy)<=3
            return True
        else:
            return False

Note: Don’t post working code.

1 Like

I was trying to help others who might face the same problem as me. And can you please explain what do you mean by don’t posting working code?

It means do not post codes that can be used to successfully complete a level.

If you are unsure about something, try reading the FAQ.
https://discourse.codecombat.com/faq