Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. u1 = raw_input("Player one:" + "\n"
  2. "Rock, paper or scissors?" + "\n"
  3. "Press 'r' for rock," + "\n"
  4. "Press 'p' for paper," + "\n"
  5. "Press 's' for scissors:")
  6.  
  7. u2 = raw_input("Player two:" + "\n"
  8. "Rock, paper or scissors?" + "\n"
  9. "Press 'r' for rock," + "\n"
  10. "Press 'p' for paper," + "\n"
  11. "Press 's' for scissors:")
  12.  
  13. def compare(p1,p2):
  14. if p1 == p2:
  15. return "Its tie!"
  16. elif p1 == "r":
  17. if p2 == "s":
  18. return ("Rock beats scissors! You win player one!")
  19. else:
  20. return("paper beats rock! You win player two!")
  21. elif p1 == "p":
  22. if p2 =="r":
  23. return ("Paper beats rock! You win player 2!")
  24. else:
  25. return("Scissors beats paper! You win player 2!")
  26. elif p1 == "s":
  27. if p2 == "p":
  28. return ("Scissors beat paper! You win player 1!")
  29. else:
  30. return("Rock beats Scissors! You win player 2!")
  31. else:
  32. return ("Invalid selection. Please choose 'r' , 'p' or 's'")
  33.  
  34.  
  35. print compare(u1,u2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement