所以这是我迄今为止的计划:
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()
但我还需要实现turtle.goto,turtle.write和turtle.color命令,这些命令需要另一个字符串或整数变量。我应该在代码的哪个部分定义这些变量?