This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

RockPaperScissors

By: ansakoy on Jul 10th, 2013  |  syntax: Python  |  size: 0.84 KB  |  views: 44  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. print '*****ROCK PAPER SCISSORS (2)*****'
  2.  
  3. a = 'rock'
  4. b = 'paper'
  5. if a == 'rock':
  6.     a = 1
  7. elif b == 'rock':
  8.     b = 1
  9. if a =='paper':
  10.     a = 3
  11. elif b =='paper':
  12.     b = 3
  13. if a =='scissors':
  14.     a = 2
  15. elif b =='scissors':
  16.     b = 2
  17. print a, b
  18.  
  19. def choice(a, b):
  20.     print 'Player 1: ' + a
  21.     print 'Player 2: ' + b
  22.     x = 'Player 1 wins'
  23.     y = 'Player 2 wins'
  24.     z = 'Tie!'
  25.     if a == 'rock':
  26.         a = 1
  27.     if b == 'rock':
  28.         b = 1
  29.     if a =='paper':
  30.         a = 3
  31.     if b =='paper':
  32.         b = 3
  33.     if a =='scissors':
  34.         a = 2
  35.     if b =='scissors':
  36.         b = 2
  37.     if a - b == 0:
  38.         return z
  39.     elif b - a == 1:
  40.         return x
  41.     elif a - b == 1:
  42.         return y
  43.     elif a - b == 2:
  44.         return x
  45.     elif b - a == 2:
  46.         return y
  47. print choice('scissors', 'scissors')
clone this paste RAW Paste Data