[SOLVED]Usual day Level help needed

Hi I am looking at my code and on line 12 it states that “item” is not defined
Here is my code:

# Defeat munchkins, collect coins. Everything as usual.
# Use AND to check existence and type in one statement.

while True:
    enemy = hero.findNearestEnemy()
    # With AND, the type is only checked if enemy exists.
    if enemy and enemy.type == "munchkin":
    # Find the nearest item.
    # Collect item if it exists and its type is "coin".
    if item and item.type == "coin":
        hero.moveXY(item.pos.x, item.pos.y)

Change this

To this


Now your code should work

other than that you should be good and keep this in mind.

Thank you. Have a great day.

you too :grin:
glad to help

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.