user == "paper" or "Paper"
is always true. The or
operator tests the expressions on either side of itself, and if either is true, the result of the or
is also true. Your test above checks (up to) two things:
- Is the expression
user == "paper"
true? If so, the whole expression is true, so don't check the second part, becauseTrue or x
is always true regardless of the value ofx
. - Is the expression
"Paper"
true? And because non-zero-length strings are true in Python, this part is always true.
So even if the first part is false, the second part is always true, so the expression as a whole is always true.
You wanted something like this:
user == "paper" or user == "Paper"
or, better yet:
user in ("paper", "Paper")
or, best of all:
user.lower() == "paper"