1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Reading three or more separate values in one line in python [duplicate]

Discussão em 'Python' iniciado por Stack, Setembro 14, 2025.

  1. Stack

    Stack Membro Participativo


    So here's my program so far:

    import turtle
    turtle.showturtle()
    def turtle_commands():
    while True :
    n = 0
    instructions = input().split()
    i = instructions[0]
    if len(instructions) > 1:
    n = int(instructions[1])
    if i == 'forward' :
    turtle.forward(n)
    elif i == 'backward' :
    turtle.backward(n)
    elif i == 'left' :
    turtle.left(n)
    elif i == 'right' :
    turtle.right(n)
    else :
    continue
    elif i == 'new' :
    turtle.reset()
    print("\n" * 50)
    elif i == 'penup' :
    turtle.penup()
    elif i == 'pendown' :
    turtle.pendown()
    print('Control the turtle!')
    turtle_interface()


    But i also need to implement turtle.goto, turtle.write and turtle.color commands, which would need another string or integer variable. In what part of the code should i define these variables?

    Continue reading...

Compartilhe esta Página