You play rock-paper-scissors with a friend and note each round as "yours-theirs", like "rock-scissors". Same throw is a draw. Write rps_winner(rounds) to return "you" if you won more rounds, "friend" if they did, and "tie" if even (or no rounds).
rps_winner(["rock-scissors", "paper-scissors", "rock-paper"])→'friend'rps_winner(["paper-rock", "rock-rock"])→'you'rps_winner([])→'tie'def rps_winner(rounds):
beats = {"rock": "scissors", "scissors": "paper", "paper": "rock"}
me = 0
friend = 0
for r in rounds:
mine, theirs = r.split("-")
# your code here: skip a draw; my win adds to me, else to friend
pass
if me > friend:
return "you"
if friend > me:
return "friend"
return "tie"
Run tries the examples. When they look right, Submit.