forked from Graey/pythoncharmers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrpsgame.py
33 lines (25 loc) · 912 Bytes
/
rpsgame.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
import random
options = ['rock', 'paper', 'scissors']
while True:
comp = random.choice( options )
player = input("Enter your choice[rock, paper, scissors or stop]: ")
if player == "stop":
break
if player == comp:
print("It is a draw")
else:
if player == 'rock':
if comp == 'paper':
print("Computer won, because it chose Paper")
else:
print("Player won because Computer chose", comp)
elif player == 'paper':
if comp == 'rock':
print("Player won because Computer chose Rock")
else:
print("Computer won, it chose", comp)
elif player == 'scissors':
if comp == 'rock':
print("Computer won, it chose Rock")
else:
print("Player won because Computer chose", comp)