Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

DO MY HOMEWORK :DD EBIN

Name: Anonymous 2012-11-14 19:55

Hello /prog/,
I need your help. This is my program so far
import turtle
turtle.showturtle()
def turtle_interface():
    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)
              elif i == 'quit' :
                  break
              elif i == 'new' :
                  turtle.reset()
              else :
                  continue
print('Control the turtle!')
turtle_interface()

As you can see, when the string has no [n] after it, it's being ignored. How can I fix this?

Name: Anonymous 2012-11-14 21:08

New thread subject: /prog/'s source code

Has anyone ever checked the HTML of this site? It's unindented and hard to read. I propose we rewrite the Shiit ``in Lisp''. We could write an API that uses S-expressions for data exchange (JSON is gay) and rewrite /prog/ ``in Lisp''.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List