-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStone-Paper-Scissors.py
More file actions
46 lines (45 loc) · 1.14 KB
/
Stone-Paper-Scissors.py
File metadata and controls
46 lines (45 loc) · 1.14 KB
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
import random
rand=random.randint(1,3)
if rand==1:
comp='STONE'
elif rand==2:
comp='PAPER'
elif rand==3:
comp='SCISSOR'
print('Computer Played')
player=input("Player Turn: STONE PAPER OR SCISSOR ??\n")
if player=='STONE'or player=='PAPER'or player=='SCISSOR':
pass
else:
exit()
def game(comp,player):
if comp=='STONE':
if player=='PAPER':
return True
elif player=='SCISSOR':
return False
elif player=='STONE':
return None
if comp=='PAPER':
if player=='STONE':
return False
elif player=='SCISSOR':
return True
elif player=='PAPER':
return None
if comp=='SCISSOR':
if player=='PAPER':
return False
elif player=='STONE':
return True
elif player=='SCISSOR':
return None
print('Computer Played %s'%comp)
print('You Played %s'%player)
winner=game(comp,player)
if winner==None:
print('The Game Is Tied!')
elif winner==True:
print('You WON!!')
elif winner==False:
print('Computer WON!! You Lost!!')