Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def rock_paper_scissors(user):
- list = ['rock', 'paper', 'scissors']
- comp = list[random.randint(0,2)]
- while user == comp:
- user = raw_input("Draw! Go again: ")
- comp = list[random.randint(0,2)]
- else:
- if comp == 'rock' and user == 'scissors':
- return("I picked rock, I win!")
- elif comp == 'rock' and user == 'paper':
- print("I picked rock, you win!")
- elif comp == 'paper' and user == 'rock':
- print("I picked paper, I win!")
- elif comp == 'paper' and user == 'scissors':
- print("I picked paper, you win!")
- elif comp == 'scissors' and user == 'paper':
- print("I picked scissors, I win!")
- elif comp == 'scissors' and user == 'rock':
- print("I picked scissors, you win!")
- play_again = raw_input("Would you like to play again?: ")
- if play_again == 'y':
- rock_paper_scissors(raw_input("You go: "))
- return("Bye!")
- else:
- return("Ok, bye!");
- print rock_paper_scissors(raw_input("You go: "));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement