Https://codecombat.com/play/level/second-gem?

Hello. help with the task “second gem” in the desert. it seems the code is correct. after the second cycle, the gems no longer come out.

while True:
    items = hero.findItems()
    # Если длина массива больше или равна 2:
    gem2=items[1]
    if len(items)>=2:
        # Двигайся ко второму предмету массива.
        hero.moveXY(gem2.pos.x, gem2.pos.y)
    # Иначе:
    else:
        # Двигайся в центр.
        hero.moveXY(40, 33)

Please learn to post your code correctly. The way it is now, we can’t see the structure. Help us help you. It’s very easy to do and just takes a tiny bit of effort. Please read this topic and format your code again correctly

here did … and what’s the difference? why the first code didn’t work?
Mod edit: Please do not post successful solutions.

We do not post successful solutions on the board, as it interferes with learning. The difference between the first code and the second code is that in the first code you’re checking the second gem before the length of the gem is greater than or equal to 2. While in the second code, you are checking the second gem after the length of the gem is greater than or equal to 2.