I am learning Python by trying to code up a simple adventure game. I have created a while loop to get a choice of direction from the user and I am clearly not doing it in an efficient way. I have created a while loop with multiple 'or' conditions to keep looping until the user provides one of the four valid directions as input. Unfortunately this extends the line beyond 80 characters with the tab. What is the best way to either break this line onto two lines so as not to get a syntax error or write this sort of loop more efficiently?
while direction != "N" or direction != "S" or direction != "E" or direction != "W":
if direction == "N":
print "You went N to the Mountain Pass"
return 'mountain'
elif direction == "S":
print "You went S to the Shire"
return 'shire'
elif direction == ...
When I try to break the first line into two, no matter where I break it I get a syntax error...
File "sct_game1.py", line 71
while direction != "N" or direction != "S" or
^
SyntaxError: invalid syntax
I'm open to suggestions on how to break the line successfully, or even better, writing this loop more efficiently.
Thanks.