Reputation: 561
Why is this line of code always returning true?
def GetPlayersMove(self):
self.move = input("Enter Rock, Paper or Scissors: ")
if self.move.lower() not in ["rock" "paper", "scissors"]:
print("Error")
Upvotes: 2
Views: 98
Reputation: 369034
The code is missing ,
.
["rock" "paper", "scissors"]
# ^
"rock" "paper"
is equivalent to "rockpaper"
:
>>> ["rock" "paper", "scissors"]
['rockpaper', 'scissors']
>>>
See String literal concatenation
Upvotes: 12