| about | help | code help+videos | done | prefs |
In the game of rock-paper-scissors, players A and B simultaneously reveal a choice of rock or paper or scissors; rock beats scissors, paper beats rock, and scissors beats paper. It is a tie if both players play the same thing. Write a function rock_paper_scissors(a, b), where a and b are the player's moves, which must be 'rock' or 'paper' or 'scissors', that returns +1 if player A wins, -1 if player A loses, and 0 if it is a tie. rock_paper_scissors('rock', 'rock') → 0 rock_paper_scissors('rock', 'paper') → -1 rock_paper_scissors('rock', 'scissors') → 1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 202 Post-solution available
Copyright Nick Parlante 2017 - privacy