Elif Syntax Error In Python
This is my code for a if/elif/else conditional for a text-based adventure game I'm working on in Python. The goal of this section is to give the player options on what to do, but i
Solution 1:
Edit: although this is something that's also wrong, it's not the cause of his SyntaxError
There must be something in a code block. Because of your commenting out some lines:
elif command.lower() in ["south", "s"]:
#forest()elif command.lower() in ["west", "w"]:
There is no code in the block after the first elif:, so you get a syntax error when the next elif: is found instead.
Add a pass
statement in the blocks you have commented out:
elif command.lower() in ["south", "s"]:
#forest()passelif command.lower() in ["west", "w"]:
pass
does nothing, but it can form a block in cases like this.
Post a Comment for "Elif Syntax Error In Python"