-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRSP.py
62 lines (38 loc) · 1.5 KB
/
RSP.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
60
61
62
import random
def Rock_rule():
if player_choice == "Rock" and computer_choice == selection[2]:
print("Player wins")
if computer_choice == selection[0] and player_choice == "Scissors":
print("CPU wins")
def Paper_rule():
if player_choice == "Papers" and computer_choice == selection[0]:
print("Player wins")
if computer_choice == selection[1] and player_choice == "Rock":
print("CPU wins")
def Scissors_rule():
if player_choice == "Scissors" and computer_choice == selection[1]:
print("Player wins")
if computer_choice == selection[2] and player_choice == "Papers":
print("CPU wins")
def Tie_rule():
if player_choice == computer_choice:
print("Tie")
selection = ["Rock", "Papers", "Scissors"]
choice = True
while choice:
print("welcome to Rock Paper Scissors game")
player_choice = input(
"which one will you like to select? (Rock Papers Scissors)\n")
computer_choice = random.choice(selection)
print("Player: %a" % player_choice)
print("CPU: %a" % computer_choice)
if player_choice == "Rock" or computer_choice == selection[0]:
print(Rock_rule())
elif player_choice == computer_choice:
Tie_rule()
elif player_choice == "Papers" or computer_choice == selection[1]:
Paper_rule()
elif player_choice == "Scissors" or computer_choice == selection[2]:
Scissors_rule()
else:
print("not amongst our option")