I am trying to make a function that randomly throws the strings of rock paper or scissors. However when I debug I notice that the variable attaching random. choice is in the following format:
That means that the condition is never met. This the code of my function.: I know is not complete.
def detect(player_pick):
enemy_pick = str(random.choices(['rock', 'paper', 'scissors']))
# Rock detection
if enemy_pick == 'rock' and player_pick == 'scissors':
print("you lose")
return "rock_win_enemy"
elif enemy_pick == 'scissors' and player_pick == 'rock':
print("Enemy lose")
return "rock_win_player"
elif enemy_pick == 'rock' and player_pick == 'rock':
print("tie")
return "tie"
# Paper detection
# Scissors detection
Aucun commentaire:
Enregistrer un commentaire