Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] I need help teachers


Could you plz help me

1 Like

Here is my code to help me complete Blackwoods Forest : Blind Distance

Tell the wizard the distance to the coming ogres.

This function finds the nearest enemy and returns the distance to it.

If there is no enemy, the function returns 0.

def nearestEnemyDistance():
enemy = hero.findNearestEnemy()
result = 0
if enemy:
result = hero.distanceTo(enemy)
return result

while True:
# Call nearestEnemyDistance() and
# save the result in the variable enemyDistance.
enemyDistance = nearestEnemyDistance()
# If the enemyDistance is greater than 0:

    # Say the value of enemyDistance variable.
1 Like

Please format the code in FAQ format by using the triple brackets or by clicking the </> when you edit your post. It could be an indentation issue


I believe you forgot a piece of code at the end. Make sure you check that enemyDistance is greater than 0. If so, say “enemyDistance


i got that part but i have no idea what the next on is :cry:


What do you mean next one? Make sure you do what I wrote first.


i did do that but it still did not work


oh i figuerd it out now i completed it


Congrats. (20 Characters)


thank you for helping me