MCPcopy Create free account
hub / github.com/geekcomputers/Python / decide_winner

Function decide_winner

BrowserHistory/rock_paper_scissors.py:26–37  ·  view source on GitHub ↗

Decide the winner based on the choices.

(player, computer)

Source from the content-addressed store, hash-verified

24
25
26def 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
40def main():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected