def travels(answer, need, location):
#travel north
if answer == "north":
return "you travel north"
#travel south
elif answer == "south":
return "you travel south"
#travel east
elif answer == "east":
return "You travel east"
#travel west
elif answer == "west":
return "You travel west"
basically the function travels is supposed to take in a string (answer) as well as two other variables (which I haven't gotten to yet) and determine a direction that a person travels. However, when I run this I get the response:
Traceback (most recent call last):
File "cavernousJ.py", line 3, in <module>
from travels import lookAround, findAnswer
File "/home/cg/root/travels.py", line 13
elif answer == "west":
^
SyntaxError: invalid syntax
1) Where is this syntax error? 2) Why does the terminal respond with an error on the "west" elif and not "south" elif?
All the tutorials I have read seem to indicate that I have used the correct format for the elif statement. Other code where I use a series of elif statements are similar (and not giving me problems). I know it's not the equals sign, and I know I'm supposed to use a : at the end of the elif statement.