# Rock-Scissor-Paper made Easy with Python – An Introduction to Randomness in Python

## What will we cover?

How to use Randomness in Python and create a Rock-Scissor-Paper game.

## Step 1: Randomness in Python

To make games interesting you need some unpredictable aspects. This is where randomness is used.

Luckily, Python has a library to make randomness. To simulate rolling a die can be done as follows.

```import random
die = random.randint(1, 6)
print(die)
```

Where randint(1, 6) returns a random integer from 1 to 6, both inclusive.

## Step 2: The Rock-Scissor-Paper game

I think most know the game. If not, read the rules on wiki.

Let’s try a game of it.

```print("Enter choice \n 1. Rock \n 2. Paper \n 3. Scissor \n")
choice = int(input("Choice: "))
computer_choice = random.randint(1, 3)
if choice == computer_choice:
print("Draw")
elif choice == 1:
if computer_choice == 2:
print("Computer wins, Paper")
else:
print("You win, Scissor")
elif choice == 2:
if computer_choice == 1:
print("You win, Rock")
else:
print("Computer wins, Scissor")
elif choice == 3:
if computer_choice == 1:
print("Computer wins, Rock")
else:
print("You win, Paper")
```