I'm writing a simple text-based game in Python 2.7. In the code below, even if the user answers something completely different than "run" or "nothing," the arrested()
function still kicks in. I'm pretty sure the problem is in this line of code:
if "run" or "nothing" in answer:
because if I only provide one string, as follows:
if "run" in answer:
the program runs beautifully, calling remote_spot()
if the answer does not contain "run". The whole code is the following:
def facing_cops():
print "There are several cars that might serve as stake-outs for the cops. What do you do?"
answer = raw_input("> ")
if "run" or "nothing" in answer:
arrested("Cops got suspicious. You are arrested, along with the drug dealer.")
else:
remote_spot()
What do you think is the matter?
Thanks,
Chris