Rock-Paper-Scissors

RockScissorsPaper

Did You Know?

Rock-paper-scissors is a hand game usually played by two people, where players simultaneously form one of three shapes with an outstretched hand. The “rock” beats scissors, the “scissors” beat paper and the “paper” beats rock; if both players throw the same shape, the game is tied.

Learning Objectives

By completing this challenge you will improve your programming skills using:

  • Selection: Using if, elif and else statements.
  • Iteration: Using either a for loop or a while loop.

The Game

Check the code below, it enables a player to play against the computer:

Challenge #1

Tweak the code below to allow the players to play 5 games. Keep a score and at the end of the 5 games display the final score and display who between the player and the computer is the overall winner.

Challenge #2

Adapt your code further to play using the best-of-5 playoff: a competition between two players (user and computer) head-to-head which must win three games to win the series. Three is chosen as it would constitute a majority of games played; if one team has won three games before all five games have been played, the games that remain are omitted.

Challenge #3

Adapt your code further to play using the best-of-5 playoff (as above) but where a lead of a minimum of two clear points is required to win the game. For instance you cannot win with a score of 3-2 but you can win with a score of 4-2. (Best of 5 with a 2-clear-point lead).

Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges

Our Latest Book

Follow this blog