Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DICT = {'scissors': 0, 'rock': 1, 'paper':2}
- def play(a,b):
- return ['Tie', 'Player 1 wins', 'Player 2 wins'][(DICT[a] - DICT[b]) % 3]
- def get_input(player_name):
- return input(f'{player_name} (Enter rock, paper or scissors): ').strip().lower()
- result = 'Tie'
- while result == 'Tie':
- player1 = get_input('Player 1')
- player2 = get_input('Player 2')
- result = play(player1, player2)
- print(result)
Add Comment
Please, Sign In to add comment