-
Notifications
You must be signed in to change notification settings - Fork 0
/
rockpaperscissors.py
44 lines (39 loc) · 1.1 KB
/
rockpaperscissors.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
30
31
32
33
34
35
36
37
38
39
40
41
42
#ROCK PAPER SCISSORS
import random
x = ''
while x!='q':
choices = ["Rock","Paper",'Scissors']
for i in enumerate(choices):
print(f'{i[0]+1}.{i[1]}')
x = int(input('Enter choice: '))
if x == 1:
x = "Rock"
choices.remove(x)
comp = random.choice(choices)
print(f'Player:{x}\nComp:{comp}')
print(f'{x} vs {comp}')
if comp == 'Paper':
print('Computer wins')
else:
print('Player wins')
elif x == 2:
x = 'Paper'
choices.remove(x)
comp = random.choice(choices)
print(f'Player:{x}\nComp:{comp}')
print(f'{x} vs {comp}')
if comp == 'Scissors':
print('Computer wins')
else:
print('Player wins')
elif x == 3:
x = 'Scissors'
choices.remove(x)
comp = random.choice(choices)
print(f'Player:{x}\nComp:{comp}\n')
print(f'{x} vs {comp}\n')
if comp == 'Rock':
print('Computer wins')
else:
print('Player wins')
x = input('Press enter to play again or q to quit:')