Mar-19-2021, 11:14 AM
(Mar-19-2021, 10:58 AM)ashergreen Wrote: It works! But I have one question: When I programmed in C many years ago, the "user1 != "rock"...." line worked perfectly and also worked when I played with BASIC back in the day. Why doesn't it work with Python?
You have an issue with your logic, not your Python code. This line will always evaluate to True, unless
user1
is somehow simultaneously equal to all three values at once (not possible):user1 != "rock" or user1 != "paper" or user1 != "scissors"You could use
and
instead of or
to fix this, or you could use in
to evaluate the variable against a group of options (a tuple in this case):user1 not in ("rock", "paper", "scissors")