Hero isn't attacking in Kithgard brawl

My code is a simple code:
enemy = hero.findNearestEnemy()
while True:
hero.attack(enemy)

I don’t care about items, I just want to beat the level.

Put
enemey = hero.findNearestEnemy() Below your while True: statement

Not sure about your language but also my while true: statement is while(true) {...}

Format your code properly. You have no loop, and you need to indent.