Decide the winner based on the choices.
(player, computer)
| 24 | |
| 25 | |
| 26 | def decide_winner(player, computer): |
| 27 | """Decide the winner based on the choices.""" |
| 28 | if player == computer: |
| 29 | return "It's a draw!" |
| 30 | elif ( |
| 31 | (player == "rock" and computer == "scissors") |
| 32 | or (player == "paper" and computer == "rock") |
| 33 | or (player == "scissors" and computer == "paper") |
| 34 | ): |
| 35 | return "You win!" |
| 36 | else: |
| 37 | return "Computer wins!" |
| 38 | |
| 39 | |
| 40 | def main(): |