import random
def rockPaperScissors():
choices = ['Rock', 'Paper', 'Scissors']
win = {choices[1]: choices[0], choices[2]: choices[1], choices[0]: choices[-1]}
lose = {choices[1]: choices[2], choices[0]: choices[1], choices[-1]: choices[0]}
print('Welcome to ' + str(choices))
for descision in range(1, 6):
print('Choose your move! ' + str(choices))
move = input()
if move not in choices:
print('You need to follow my instructions Sammy...\n')
else:
break
if move in choices:
print(".")
else:
print("Now you've done it")
rockPaperScissors()
randomChoice = random.choice(choices)
check = {move: randomChoice}
print(randomChoice)
print('You chose ' + move + ' and I chose ' + randomChoice)
#
# VVV What I am having trouble with VVV #
#
if check.items() == any(win.items()):
print('You Win')
elif check.items() == any(lose.items()):
print('You Lose')
else:
print('Tie!')
rockPaperScissors()
This is my first python project. I decided to try and create a simple rock paper scissors program but am struggling to finalize the win/lose conditions. I have created a dictionary for a "win" and a "lose" which has all the conditions for each. What I am trying to do is create a new dictionary with "check" and then using the following if statement to see if it matches with a tuple in "win" or "lose". What comes back is always win, regardless of the actual outcome. I might be making this more complicated than needed but any thoughts would be appreciated.
if check in win: print('You Win')
I've tried this as an alternative but I receive a TypeError: unhashable type: dict