tags:
- code
topic: List
difficulty: Easy
link: https://www.codewars.com/kata/5672a98bdbdd995fad00000f
date: 2023-12-31
Problem
Rock Paper Scissors
Let's play! You have to return which player won! In case of a draw returnDraw!
.
"scissors", "paper" --> "Player 1 won!"
"scissors", "rock" --> "Player 2 won!"
"paper", "paper" --> "Draw!"
def rps(p1, p2):
combos = [("scissors", "paper"), ("paper", "rock"), ("rock", "scissors")]
if p1 == p2:
return("Draw!")
for i in combos:
if (p1,p2) == i:
return "Player 1 won!"
else:
return "Player 2 won!"