[Python] Reeborg's World Around 1 - Variable (Python's While Loop)

Discussão em 'Python' iniciado por Stack, Janeiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm new to programming and I'm trying my hand at Reeborg's World https://reeborg.ca/reeborg.html problems. However, I've reached a block at Around 1 - Variable.

    This is my code right now:

    def walk():
    if wall_on_right()==True and wall_in_front()==False:
    move()
    if wall_in_front()==True:
    turn_left()
    move()

    put("token")
    move()
    while object_here("token")!=True:
    walk()
    if object_here("token")==True:
    done()


    The problem is that it creates an infinite loop. It seems that the while function is not recognizing the token put at the starting position as a the condition that breaks out of the loop.

    Thank you for your help.

    Continue reading...

Compartilhe esta Página