-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScissor_Paper_Stone_Game.py
More file actions
66 lines (51 loc) · 1.91 KB
/
Copy pathScissor_Paper_Stone_Game.py
File metadata and controls
66 lines (51 loc) · 1.91 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Scissor Paper Stone
import random
def random_choice_gen():
print('Let\'s start the game "Snake Water Gun" ')
count = 0
win = 0
draw = 0
lst =["Snake", "Water", "Gun"]
print("1-Snake, 2-Water, 3-Gun")
print("You Got 10 chances")
try:
while count<10:
cpu_choice = random.randint(0, 2)
print("****** Turn-", count+1, " ******")
user_choice = int(input("Please enter your choice : "))
while user_choice>2 or user_choice<0:
print("your input is invalid")
user_choice = int(input("Please insert again : "))
print("your choice : ", lst[user_choice])
print("computer's choice : ", lst[cpu_choice])
if user_choice == cpu_choice:
print("Draw")
draw += 1
else:
if user_choice ==0:
if cpu_choice == 1:
print("You win the Game")
win +=1
if cpu_choice == 2:
print("You lost the game")
elif user_choice == 1:
if cpu_choice == 0:
print("You lost the Game")
if cpu_choice == 2:
print("You win the Game")
win += 1
elif user_choice == 2:
if cpu_choice == 0:
print("You win the Game")
win += 1
if cpu_choice == 1:
print("You lost the Game")
count += 1
print("********Reaults********")
print("Your Total Win : ", str(win))
print("Computer Total Win : ", str(10-win-draw))
print("Total No. of Draws : ", str(draw))
except Exception as e:
print("Something went wrong")
if __name__ == "__main__":
random_choice_gen()