# Create Your First Python Game Rock, Paper, Scissors

What is Rock Paper Scissors and How to play it?

Its a game played by 2 people with their hands, The idea is to create 3 shapes with the hands

Rock, Paper, Scissors shapes

It has 3 simple rules

• With Rock and scissors -> Rock wins
• With Scissors and paper -> Scissors wins
• With Paper and Rock -> Paper wins

Here in our example, We are going to play Rock Paper Scissors with a computer

Code:

```import random

rock = '''

_______

---' ____)

(_____)

(_____)

(____)

---.__(___)

'''

paper = '''

_______

---' ____)____

______)

_______)

_______)

---.__________)

'''

scissors = '''

_______

---' ____)____

______.)

__________)

(____)

---.__(___)

'''

user_choice= int(input("Enter 0 for Rock,1 for paper or 2 for Scissors \n"))

computer_choice=random.randint(0,2)

rpc=[rock, paper, scissors]

if user_choice >=3 or user_choice < 0:

print("Incorrerct Choice")

elif user_choice==computer_choice:

print(rpc[user_choice])

print(rpc[computer_choice])

print("Draw")

elif user_choice==0 and computer_choice==2:

print(rpc[user_choice])

print(rpc[computer_choice])

print ("You Win")

elif user_choice==2 and computer_choice==1:

print(rpc[user_choice])

print(rpc[computer_choice])

print("You Win")

elif user_choice==1 and computer_choice==0:

print(rpc[user_choice])

print(rpc[computer_choice])

print ("You Win!")

else:

print ("You Lose!")```

Try it Yourself

Explanation:

Before starting, Please check here to know more about Randomization. Which is used in this program.

– We need to get input from the user either 0,1,2 (Rock, Paper, Scissors)

– Then need to implement the random module to create random 0,1,2 (from the computer side)

– Once it is done, We need to implement the rules for the game

With Rock and scissors -> Rock wins

With Scissors and paper -> Scissors wins

With Paper and rock -> Paper wins

– This can be achieved by condition flow “if else”

Above program is my way of creating a Rock Paper Scissors game. You can redesign the game in your own logic.

Check here for more Python learning series posts