Created
March 9, 2014 22:27
-
-
Save keshavsaharia/9455888 to your computer and use it in GitHub Desktop.
RPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
currentround = 0 | |
rounds = 5 | |
while currentround < rounds: | |
currentround + 1 | |
answer = input("Select rock paper or scissors") | |
while answer != "rock" and answer != "paper" and answer != "scissors": | |
print "Bad answer" | |
answer = input("Select rock paper or scissors") | |
rolled = random.randint(1, 3) | |
computer = "blah" | |
if rolled == 1: | |
computer = "rock" | |
if rolled == 2: | |
computer = "paper" | |
if rolled == 3: | |
computer = "scissors" | |
print "I chose " + answer | |
print "Computer picked " + computer | |
if answer == "scissors" and computer == "paper": | |
print "Scissors beats paper, I win!" | |
if answer == "scissors" and computer == "rock": | |
print "Rock beats scissors, you lose!" | |
if answer == "scissors" and computer == "scissors": | |
print "There was a tie." | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment