Rock Paper Scissors
Beginner
Welcome to the world of Rock, Paper, Scissors! This is a game where you and your friend can challenge each other.
Let's create a function rock_paper_scissors that helps determine the winner of this classic game.
Here are the rules:
- Rock crushes Scissors.
- Scissors cut Paper.
- Paper covers Rock.
The function will receive two arguments: player1 and player2, each converting to either "rock", "paper", or "scissors".
The function should return:
"Player 1 wins!"if Player 1 wins."Player 2 wins!"if Player 2 wins."It's a tie!"if both players choose the same.
Example
rock_paper_scissors("rock", "scissors") # Output: "Player 1 wins!" rock_paper_scissors("paper", "rock") # Output: "Player 1 wins!" rock_paper_scissors("scissors", "rock") # Output: "Player 2 wins!" rock_paper_scissors("rock", "rock") # Output: "It's a tie!"
Inputs
Arg 1:
"rock"Arg 2:
"scissors"Expected Output
"Player 1 wins!"Actual Output