Got code that looks like this, and it's not working properly?
if x == "foo" or "bar" or "baz":
Python is interpreting this as though it was this:
if (x == "foo") or ("bar") or ("baz"):
If the first expression (x == "foo"
) isn't true, the second ("bar"
) will be, so this compound conditional always passes.
Try this instead: