- Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrock-paper-scissors.py
59 lines (38 loc) · 932 Bytes
/
rock-paper-scissors.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/python3
fromrandomimportrandint
player=input('rock (r), paper (p) or scissors (s)?')
if(player=='r'):
print('O', end=' ')
elif(player=='p'):
print('___', end=' ')
elif(player=='s'):
print('>8', end=' ')
else:
print('??')
print('vs', end=' ')
chosen=randint(1,3)
if(chosen==1):
computer='r'
print('O')
elif(chosen==2):
computer='p'
print('___')
else:
computer='s'
print('>8')
if(player==computer):
print('DRAW!')
elif(player=='r'andcomputer=='s'):
print('Player wins!')
elif(player=='r'andcomputer=='p'):
print('Computer wins!')
elif(player=='p'andcomputer=='r'):
print('Player wins!')
elif(player=='p'andcomputer=='s'):
print('Computer wins!')
elif(player=='s'andcomputer=='p'):
print('Player wins!')
elif(player=="s"andcomputer=='r'):
print('Computer wins!')
else:
print('Huh?')