Learn Python by Making Stone paper Scissor game

  • This game is played between a human player and the CPU.
  • The user can choose any of the Stone, Paper, and Scissors, and the CPU will choose with any random choice from these options.
  • In each round, there are two outcomes, either one player wins or a tie.
  • The basic rule for the win is “Stone crushes scissors” or “Paper covers stone” or “Scissors cut paper”. Otherwise a draw.
  • The game is continued until any of the user or CPU scores 5.
  • Accepting and displaying information in the terminal
  • Basic data structures — Lists, & Dictionaries
  • Basic Control structures
python game.py
import random
import <module_name> from <module_name> import <submodule/function/class/variable> from module.submodule import <function/variable>
print("\nWelcome to stone paper scissor game")
name = input("\nPlease enter your name: ")
valid_entries = ['st', 'pa', 'sc']
choice_name_map = { "st": "Stone", "pa": "Paper", "sc": "Scissor" }
def method_name(argument 1, argument 2, ...): 
<method definition>
while condition: 
<block of statements>
valid_entries = ['st', 'pa', 'sc']
entry in valid_entries
if condition1:
<statement block 1>
elif condition 2:
<statement block 2>
elif condition n:
<statement block n>
<default block>
python game.py



Coding, Reading,Python

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store