Usual day help python

@dedreous

while True:
    enemy = hero.findNearestEnemy()
if enemy and enemy.type == "munchkin":
    hero.attack(enemy)
else :
    item = hero.findNearestItem()
if item:
    itemPosition = item.pos
    itemX = itemPosition.x
    itemY = itemPosition.y
    hero.moveXY(itemX, itemY)

I am able to get the coins but i cant attack the orges i am in python!!

Double check your alignment.

@ZAX155 You don’t need the else statement. Also you can write like this instead of naming new variables. Everything else looks good.

if item and item.type == "???" :
        hero.moveXY(item.pos.x, item.pos.y);

not quite…what happened to your attack code? Based on the comments shown above, you’ve copied a block of code from another level and now the comments are not correct…they appear to be leading you in the wrong direction.

You should Restart the level and start from scratch…you can copy this code to Notepad (or something) so you can refer to it, but absolutely do not copy the comments back in when starting over.

A clean start will look like this:
image

@ZAX155 How are you doing on this level? What are you stuck on?

You read hints yet. He helps a lot.:smiley: