Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. import random
  2.  
  3. def rock_paper_scissors(user):
  4. list = ['rock', 'paper', 'scissors']
  5. comp = list[random.randint(0,2)]
  6. while user == comp:
  7. user = raw_input("Draw! Go again: ")
  8. comp = list[random.randint(0,2)]
  9. else:
  10. if comp == 'rock' and user == 'scissors':
  11. return("I picked rock, I win!")
  12. elif comp == 'rock' and user == 'paper':
  13. print("I picked rock, you win!")
  14. elif comp == 'paper' and user == 'rock':
  15. print("I picked paper, I win!")
  16. elif comp == 'paper' and user == 'scissors':
  17. print("I picked paper, you win!")
  18. elif comp == 'scissors' and user == 'paper':
  19. print("I picked scissors, I win!")
  20. elif comp == 'scissors' and user == 'rock':
  21. print("I picked scissors, you win!")
  22. play_again = raw_input("Would you like to play again?: ")
  23. if play_again == 'y':
  24. rock_paper_scissors(raw_input("You go: "))
  25. return("Bye!")
  26. else:
  27. return("Ok, bye!");
  28.  
  29. print rock_paper_scissors(raw_input("You go: "));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement