running a program I am making to draw with turtle graphics, I put in an exit command, however now whenever I enter any single-word commands I get an indexerror (IndexError: list index out of range) at the elif for the "back" command:
def parse_line(line):
global items_in_line
items_in_line = line.split(" ",1)
if items_in_line[0] == "forward":
if isinstance(items_in_line[1], int):
return items_in_line
elif items_in_line[0] == "back" or "backward":
if isinstance(items_in_line[1], int):
return items_in_line
...
elif items_in_line[0] == "exit":
sys.exit()
line=input("Enter a turtle command or enter 'file' to load commands from a file")
x = parse_line(line)
Why? and how can I fix this?