Advertisement
ansakoy

Rock Paper Scissors

Jun 30th, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1. print '***ROCK PAPER SCISSORS***'
  2.  
  3. pl1 = raw_input("Enter Player 1's choice (rock, paper or scissors): ")
  4. pl1 = pl1.lower() # convert input into lower case
  5.  
  6. # Making sure the input is valid
  7. if pl1 == 'rock' or pl1 == 'paper' or pl1 == 'scissors':
  8.     print 'Player 1: ' + pl1
  9. else:
  10.     print 'Invalid input'
  11.  
  12. pl2 = raw_input("Enter Player 2's choice: ")
  13. pl2 = pl2.lower() # convert input into lower case
  14. # Making sure the input is valid
  15. if pl2 == 'rock' or pl2 == 'paper' or pl2 == 'scissors':
  16.     print 'Player 2: ' + pl2
  17. else:
  18.     print 'Invalid input'
  19. if pl1 == 'rock' and pl2 == 'rock':
  20.     print 'Tie'
  21. elif pl1 == 'rock' and pl2 == 'scissors':
  22.     print 'Player 1 wins'
  23. elif pl1 == 'rock' and pl2 == 'paper':
  24.     print 'Player 2 wins'
  25. elif pl1 == 'paper' and pl2 == 'rock':
  26.     print 'Player 1 wins'
  27. elif pl1 == 'paper' and pl2 == 'scissors':
  28.     print 'Player 2 wins'
  29. elif pl1 == 'paper' and pl2 == 'paper':
  30.     print 'Tie'
  31. elif pl1 == 'scissors' and pl2 == 'rock':
  32.     print 'Player 2 wins'
  33. elif pl1 == 'scissors' and pl2 == 'scissors':
  34.     print 'Tie'
  35. elif pl1 == 'scissors' and pl2 == 'paper':
  36.     print 'Player 1 wins'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement