-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rock Paper Scissors
38 lines (30 loc) · 960 Bytes
/
Rock Paper Scissors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#rock paper scissors
from random import randint
from time import sleep
options = ["ROCK", "PAPER", "SCISSORS"]
message = {
"tie": "Yawn it's a tie!",
"won": "Yay you won!",
"lost": "Aww you lost!"
}
def decide_winner(user_choice, computer_choice):
print "You chose " + str(user_choice)
sleep(1)
print "We chose " + str(computer_choice)
sleep(1)
if user_choice == computer_choice:
print message["tie"]
elif user_choice == options[0] and computer_choice == options[2]:
print message["won"]
elif user_choice == options[1] and computer_choice == options[0]:
print message["won"]
elif user_choice == options[2] and computer_choice == options[1]:
print message["won"]
else:
print message["lost"]
def play_RPS():
user_choice = raw_input("Enter Rock, Paper, or Scissors: ")
user_choice = user_choice.upper()
computer_choice = options[randint(0, 2)]
decide_winner(user_choice, computer_choice)
play_RPS()