# \[SOLVED\]If anyone can please help

**URL:** https://discourse.codecombat.com/t/solved-if-anyone-can-please-help/26496
**Category:** Level Help
**Created:** [January 11, 2021, 6:04am UTC](https://discourse.codecombat.com/t/solved-if-anyone-can-please-help/26496 "2021-01-11T06:04:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Archipelago-Gold](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archipelago-gold/32/18442_2.png) [@Archipelago-Gold](https://discourse.codecombat.com/u/Archipelago-Gold)
#### Post date: [January 11, 2021, 6:04am UTC](https://discourse.codecombat.com/t/solved-if-anyone-can-please-help/26496/1 "2021-01-11T06:04:38Z")

</div>

So I am having issues with it stopping in my code and need someone to look over my code and see what did wrong. Can anyone help?

```python
 #Commented out to stop infinite loop.

# Kill at least 6 ogres on the left side.
# Then, collect at least 30 gold on the right.
# This variable is used for counting ogres.
defeatedOgres = 0;

# This loop is executed while "defeatedOgres" is less than 6.
while defeatedOgres < 6:
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.attack(enemy)
        defeatedOgres += 1
    else:
        hero.say("Ogres!")

# Move to the right part of the map.
hero.moveXY(49, 36)

# This loop is executed while you have less than 30 gold.
while hero.gold < 30:
    # Find and collect coins.
    item = hero.findNearest(hero.findItems())
    if item:
        hero.move(item.pos)
    
# Move to the exit.
hero.moveXY(76, 32)

```

---

<div class="post-metadata">

### Author: ![Lydia\_Song](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/lydia_song/32/31461_2.png) [@Lydia\_Song](https://discourse.codecombat.com/u/Lydia_Song)
#### Post date: [January 11, 2021, 2:41pm UTC](https://discourse.codecombat.com/t/solved-if-anyone-can-please-help/26496/3 "2021-01-11T14:41:06Z")

</div>

What level is this?  
Lydia  
(In the future, please tell the level. If you have solved it, please delete your code if it runs and successeds so others don’t try and cheat)

---

<div class="post-metadata">

### Author: ![Archipelago-Gold](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/archipelago-gold/32/18442_2.png) [@Archipelago-Gold](https://discourse.codecombat.com/u/Archipelago-Gold)
#### Post date: [January 11, 2021, 2:47pm UTC](https://discourse.codecombat.com/t/solved-if-anyone-can-please-help/26496/4 "2021-01-11T14:47:40Z")

</div>

Okay thanks for that
