Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

[SOLVED]Long range division-Python-Help


I’m stuck… Anyone can help me ? Thank you.

# Destroy the mines!
# Use say to call out the range to the mines.
# Use division to calculate the range.

enemy = hero.findNearestEnemy()
distanceToEnemy = hero.distanceTo(enemy)

# Say first Range: distanceToEnemy divided by 3
hero.say(distanceToEnemy / 3)
# Say second range: distanceToEnemy divided by 1.5
hero.say(distanceToEnemy / 1.5)

# Say these things for motivation. Really. Trust us.
hero.say("Woo hoo!")
hero.say("Here we go!")

# Now, use a while-true loop to attack the enemies.
while True:
    enemy = hero.findNearestEnemy()
    if enemy :


What happens when you run the code? Are you getting an error message? What does your hero do?

Please post a screen shot of your equipment. This may be a gear issue.


My hero can’t defeat the ogres. Thank you.


This is an equipment/gear issue. That wand isn’t inflicting much damage. It only inflicts 2.5 damage with each strike. Those two ogres have a combined total of 150 health. That means, with that wand, you would have to hit the two of them with 60 fire balls (30 a piece). You simply don’t have the time for that.

Either get a much better wand or just use a hero with a good sword. Your code is fine.


Just sloved! Thank you so much~ :smile: