# A fine mint (level trouble)

**URL:** <https://discourse.codecombat.com/t/a-fine-mint-level-trouble/9271>\
**Category:** Uncategorized\
**Created:** [October 12, 2016, 2:42pm UTC](https://discourse.codecombat.com/t/a-fine-mint-level-trouble/9271 "2016-10-12T14:42:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Walla-walla234](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@Walla-walla234](https://discourse.codecombat.com/u/Walla-walla234)\
**Post date:** [October 12, 2016, 2:42pm UTC](https://discourse.codecombat.com/t/a-fine-mint-level-trouble/9271/1 "2016-10-12T14:42:19Z")

</div>

Hi. I can’t figure out what the problem in my python code is. Please help. My code is:

# Peons are trying to steal your coins!

# Write a function to squash them before they can take your coins.

enemy = hero.findNearestEnemy()

def pickUpCoin():  
coin = hero.findNearestItem()  
if coin:  
hero.moveXY(coin.pos.x, coin.pos.y)

# Write the attackEnemy function below.

# Find the nearest enemy and attack them if they exist!

def attackEnemy():  
hero.attack(enemy)

while True:  
#attackEnemy() # ∆ Uncomment this line after you write an attackEnemy function.  
attackEnemy()  
pickUpCoin()

Thank you!

---

<div class="post-metadata">

**Author:** ![Harry\_the\_Wanderer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/harry_the_wanderer/32/5369_2.png) [@Harry\_the\_Wanderer](https://discourse.codecombat.com/u/Harry_the_Wanderer)\
**Post date:** [October 12, 2016, 4:16pm UTC](https://discourse.codecombat.com/t/a-fine-mint-level-trouble/9271/2 "2016-10-12T16:16:58Z")

</div>

@Walla-walla234 where is your `attackEnemy()` function?

The hero cannot defeat enemies unless you are attacking them. So if there is no “hero.attack()” function anywhere in the code, the is a good chance that the hero won’t be attacking.

The instructions are asking you to:

#Write the attackEnemy function below.
