First Blender Script Help

I am new to blender. I have only been working with it for a couple days, and am trying to write my first script.

I have a box that moves around with a gun, and is able to shoot. I also have “enemies” that dissapear when they are shot. I would like my script to make the “enemies” run away from my box when I get within a certain range.

Currently my script has:
cont = GameLogic.getCurrentController()
rsense = cont.getSensor(“rsense”)
if rsense.isPositive():
hit.Obj = rsense.getHitObject()
if hitObj.enemy == 1: