Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created November 14, 2018 01:08
Show Gist options
  • Save codecademydev/f8eb915e65c5dcc7b30db0d2ac183e00 to your computer and use it in GitHub Desktop.
Save codecademydev/f8eb915e65c5dcc7b30db0d2ac183e00 to your computer and use it in GitHub Desktop.
Codecademy export
"""This is a rock,paper,scissors game """
from random import randint
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 selected: %s" % user_choice
print "Computer selected: %s" % computer_choice
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"I'm sorry you lost, better luck next time!"
def play_RPS():
user_choice = raw_input("Enter Rock, Paper, Scissors: ")
user_choice = user_choice.upper()
computer_choice == options[randint(0,2)]
decide_winner(user_choice,computer_choice)
play_RPS()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment