RPS
public python v1 · immutableimport randomlook = { 0: 'Rock', 1: 'Paper', 2: 'Scissors' }revlook = { 'r': 0, 'p': 1, 's': 2 }while True: compChoice = random.randint(0,2) userChoice = revlook[raw_input('Enter your choice: ').lower()] print 'You picked %s and the computer picked %s.\n' % ( look[userChoice], look[compChoice] ) if compChoice - userChoice == 0: print 'Tie!' continue if compChoice == ( userChoice - 1 ) % 3: print 'You win!' if compChoice != ( userChoice - 1 ) % 3: print 'Computer wins!'