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

Function decide_winner

rock_paper_scissors.py:25–36  ·  view source on GitHub ↗

Decide the winner based on the choices.

(player, computer)

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected