Rock Paper Scissors Challenges
After completing the code-along, attempt the challenges below.
Optional Practice: Bug Fixes
View these buggy Repl projects and try to fix them. Test the program and make sure that all outcomes are reachable.
1. Nicer Printing
While the program should be functional after the code-along, it does not have the best user experience. Update the code to make it a little easier to read for the user.
- Add an empty
printstatement under the "Welcome" message to make a new line under it - Add another empty
printstatement above the finalinputin thewhileblock - Add another empty
printstatement at the bottom of thewhileblock - Add
printstatements above and below thebattleoutput, adding a "box" using dashes
Run the program, and make sure it is a little more usable!
BONUS: ASCII Art
ASCII art is a graphic design technique that creates images from text characters. Utilize some ASCII art to make the program more exciting!
In Python, it is possible to create multiline strings, which can make ASCII art much easier. Instead of using a single double quote ( " ) to start and end a string, use three double quotes ( """ ).
For example, this code:
value = """this is a
multiline
string"""
print(value)
will print this:
this is a
multiline
string
An example of art for Rock Paper Scissors can be found here: https://gist.github.com/wynand1004/b5c521ea8392e9c6bfe101b025c39abe
2. Handling Invalid Input
At the moment, the program works if the user enters "R", "P", or "S". However, if the player enters anything else, no message is displayed. Make some updates so that this is properly handled.
- In the
battlefunction, find the bottom of the block - At the same level as the first
if, add anelse:clause - In the
elseblock, print a message saying "Invalid Selection"
Run the program, and verify that invalid input sees a proper response!
BONUS: Boxify Valid Battle
As it is, the "Invalid Selection" will display in the same "box" as the battle statement. Update the code so that the "box" dashes only appear for a legitimate battle.
3. Tracking Score
This challenge is a little more difficult. One nice feature for the program would be the ability to track a player's wins across multiple games.
- Find the
battlefunction definition - Find each
printstatement where the player wins - Under each of those statements, with the same indentation level, add
return True- This
Trueindicates that the player won the battle
- This
- For each other
printstatement, addreturn Falsedirectly beneath - Above the
whileloop, create a new variable namedscore - Set the value of the
scorevariable to0 - Within the
whileloop, find thebattlefunction call - Set the result of the
battlecall to a new variable:won - Under the
battlecall, create anifstatement - Make the
ifstatement check ifwonisTrue - In the block of the
ifstatement, increment the value ofscoreby1 - Under the
ifstatement (outside the indented block), create aprint - Make the
printstatement print out thescorevariableprint("Score: " + str(score))
Run the program again, and verify that the score goes up with every victory!
4. More Moves
This challenge may be quite difficult. One variation of the game adds two additional move options: Spock and Lizard. This version was invented by Sam Kass and Karen Bryla, and later popularized by the CBS sitcom The Big Bang Theory.
The outcomes are as follows:

It adds this additional logic:
- Rock vs. Spock - L
- Rock vs. Lizard - W
- Paper vs. Spock - W
- Paper vs. Lizard - L
- Scissors vs. Spock - L
- Scissors vs. Lizard - W
Update the program so that it can handle these additional cases.
5. Hangman, Tic Tac Toe, or Something Else
Create a completely different console game using the same programming concepts from the Rock Paper Scissors game. Add some ASCII Art to make it fun.