/
game.py
29 lines (28 loc) · 957 Bytes
/
game.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import random
options = ['rock', 'paper', 'scissors']
print('(1) Rock\n(2) Paper\n(3) Scissors')
human_choice = options[int(input('Enter the number of your choice: ')) - 1]
print(f'You chose {human_choice}')
computer_choice = random.choice(options)
print(f'The computer chose {computer_choice}')
if human_choice == 'rock':
if computer_choice == 'paper':
print('Sorry, paper beat rock')
elif computer_choice == 'scissors':
print('Yes, rock beat scissors!')
else:
print('Draw!')
elif human_choice == 'paper':
if computer_choice == 'scissors':
print('Sorry, scissors beat paper')
elif computer_choice == 'rock':
print('Yes, paper beat rock!')
else:
print('Draw!')
elif human_choice == 'scissors':
if computer_choice == 'rock':
print('Sorry, rock beat scissors')
elif computer_choice == 'paper':
print('Yes, scissors beat paper!')
else:
print('Draw!')