i have been working on this level for days and I cant get past It i would like some clarification
my code doesn’t work and i would like help with how to make it better
def nearestEnemyDistance():
enemy = hero.findNearestEnemy()
result = 10 # you set the default distance to enemy to 10
if enemy: # and if there is no enemy
result = hero.distanceTo(enemy)
return result # the distance to enemy will be 10
# if there is no enemy
while True:
enemyDistance = nearestEnemyDistance()
if enemyDistance > 0: # this will be always true
# 10 or the real distance
hero.say(enemyDistance)
result = 10 # or some other value