Game Rules
Learn how to print the game rules.
We'll cover the following
What have we got?
We have the breakdown of the game, so let’s go through the first thing we saw in the game. When the game starts, it introduces the game and lists the rules.
What’s next?
Let’s create a function that prints the welcome message and game rules.
- Define a function named
displayInstructions()
. - Print all the rules of the game within this function.
Try it yourself
Write your code in the code widget below and click the “Run” button to execute your code.
Sample output
Welcome to Rock Paper Scissors.
The rules are simple:
1. Rock beats scissors
2. Scissors beats paper
3. Paper beats rock
If you’re unsure how to do this, click the “Show Hint” button.
Get hands-on with 1200+ tech skills courses.