0

Possible Duplicate:
Reading two separate values in one line in python

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?

Community
  • 1
  • 1

0 Answers0