#59 Rock Paper Scissors

In this version of the two-player hand game also known as Rochambeau or jan-ken-pon, the player faces off against the computer. You can pick either rock, paper, or scissors. Rock beats scissors, scissors beats paper, and paper beats rock. This program adds some brief pauses for suspense.

For a variation of this game, see Project 60, “Rock Paper Scissors (Always-Win Version).”

The Program in Action

When you run rockpaperscissors.py, the output will look like this:

Rock, Paper, Scissors, by Al Sweigart al@inventwithpython.com - Rock beats scissors. - Paper beats rocks. - Scissors beats paper. 0 Wins, 0 Losses, 0 Ties ...

Get The Big Book of Small Python Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.