Advertisement
ansakoy

Python homework: Rock Paper Scissors

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