I am making a quick zork game but I ran into this problem using the "or" operator. I thought this would be simple but I can't figure out why this isn't working. Right now if you type in "n" you should get "this works" because it equals the string "n". Instead it prints out "it works" AND "this works" so obviously I used "or" wrong.
x=0
while x<20:
response = input("HI")
if response!= 'n':
print("it works")
if response == 'n':
print("this works")
x+=1
Before using or it works
x=0
while x<20:
response = input("HI")
if (response!= 'n') or (response != 's'):
print("it works")
if (response == 'n') or (response == 's'):
print("this works")
x+=1
After using or it prints both out. It probably something obvious -.-
if/elifstatements like this, very quickly gets unwieldy. You might want to consider factoring out the parser from the rest of the code, and using a real parsing library, and turning the rooms into data instead of code, and so on. Building an adventure in something like Inform first to see how easy it can be, then trying to figure out how to make it that easy in Python, maybe be helpful.