tondeuse34

Hey guys again, well i got another question. When ever i have an if statement asking for input and i try to use an elif statement and run the code, it say's 'elif' is an syntax error. Is it an indention problem or something else? Thanks

``````print "1) Play"

if choice == 1:
ways = ['L','R','S']
ways = raw_input("Which way do you want to go(L,R,S)?: ")

elif direction == 'L':
print "You have gone left."``````

MitkOK 61

Yes, it's indention problem.

``````print "1) Play"

if choice == 1:
ways = ['L','R','S']
ways = raw_input("Which way do you want to go(L,R,S)?: ")

elif direction == 'L':
print "You have gone left."``````

tondeuse34

And one more question, here in this code:

``````print "Your choices are: "
print "1) Play"
choice = raw_input("Choose your option(1) ")

loop = 1

if choice == '1':
dir_list = ['N','S','E','W']
print "You will go throughout many places in search of the treasure, Good luck!"
direction = raw_input("Which direction do you want to go(N,S,E,W)?: ").upper()

if direction == 'N':
way_list = ['Left','Right','Straight']
print "-_-_-_-_-_-_-_-_-_-_-_-"
print "You approach an old house,"
print "The door is unlocked and you go inside"
direction = raw_input("Which way do you want to go('Left,Right,Straight)?: ")

elif direction == 'Left':
print "You have gone left"``````

Whenever i type 'Left' the programs breaks, any suggestions?

MitkOK 61

``````print "Your choices are: "
print "1) Play"
choice = raw_input("Choose your option(1) ")

loop = 1

if choice == '1':
dir_list = ['N','S','E','W']
print "You will go throughout many places in search of the treasure, Good luck!"
direction = raw_input("Which direction do you want to go(N,S,E,W)?: ").upper()

if direction == 'N':
way_list = ['Left','Right','Straight']
print "-_-_-_-_-_-_-_-_-_-_-_-"
print "You approach an old house,"
print "The door is unlocked and you go inside"
direction = raw_input("Which way do you want to go('Left,Right,Straight)?: ")

if  direction == 'Left':
print "You have gone left"
elif direction == 'Right':
print "You have gone right"
else:
print "You have gone Straight"``````

You indented "elif" in manner to check the first input

``direction = raw_input("Which way do you want to go('Left,Right,Straight)?: ")``

Thanks MitkOK