# The Agrippa Defense: Code Doesn't Work

**URL:** <https://discourse.codecombat.com/t/the-agrippa-defense-code-doesnt-work/9274>\
**Category:** Bugs\
**Created:** [October 12, 2016, 3:43pm UTC](https://discourse.codecombat.com/t/the-agrippa-defense-code-doesnt-work/9274 "2016-10-12T15:43:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aubrey\_Lynn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/aubrey_lynn/32/4897_2.png) [@Aubrey\_Lynn](https://discourse.codecombat.com/u/Aubrey_Lynn)\
**Post date:** [October 12, 2016, 3:44pm UTC](https://discourse.codecombat.com/t/the-agrippa-defense-code-doesnt-work/9274/1 "2016-10-12T15:44:00Z")

</div>

I have been stuck on this level for several days. I have even visited several of the tutorials on YouTube, and their code is exactly the same. Except, their code worked, and mine doesn’t. Can someone help me please? This is what my code looks like:

while True:  
enemy = hero.findNearestEnemy()  
if enemy:  
pass # Replace this with your own code.  
# Find the distance to the enemy with distanceTo.  
distance = hero.distanceTo(enemy)  
# If the distance is less than 5 meters…  
if distance \< 5:  
# … if “cleave” is ready, cleave!  
if hero.isReady(“cleave”):  
hero.cleave(enemy)  
# … else, just attack.  
else:  
hero.attack(enemy)

this is the link to the video that has the same code as me:

-Aubrey.

---

<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:38pm UTC](https://discourse.codecombat.com/t/the-agrippa-defense-code-doesnt-work/9274/2 "2016-10-12T16:38:21Z")

</div>

@Aubrey_Lynn The code seems to work for me. Can you use the code formatter to show us the tabs on the code. In python if the tab spacing is off it will cause different things to happen.

Click on the "Preformatted text button after highlighting your code:  
 ![](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex016/uploads/codecombat/original/2X/2/254a2bcaa6521d466fc50912bab703184f77bb0e.png)
