Skip to content

Commit e7599b3

Browse files
1st_version of Scissor_Paper_Stone.py
It's a simple code for scissor_paper_stone game built in python
1 parent 300a44d commit e7599b3

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

Scissor_Paper_Stone_Game.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Scissor Paper Stone
2+
3+
import random
4+
5+
def random_choice_gen():
6+
7+
print('Let\'s start the game "Snake Water Gun" ')
8+
count = 0
9+
win = 0
10+
draw = 0
11+
12+
lst =["Snake", "Water", "Gun"]
13+
print("1-Snake, 2-Water, 3-Gun")
14+
print("You Got 10 chances")
15+
16+
try:
17+
18+
while count<10:
19+
cpu_choice = random.randint(0, 2)
20+
print("****** Turn-", count+1, " ******")
21+
user_choice = int(input("Please enter your choice : "))
22+
23+
while user_choice>2 or user_choice<0:
24+
print("your input is invalid")
25+
user_choice = int(input("Please insert again : "))
26+
27+
print("your choice : ", lst[user_choice])
28+
print("computer's choice : ", lst[cpu_choice])
29+
30+
if user_choice == cpu_choice:
31+
print("Draw")
32+
draw += 1
33+
else:
34+
if user_choice ==0:
35+
if cpu_choice == 1:
36+
print("You win the Game")
37+
win +=1
38+
if cpu_choice == 2:
39+
print("You lost the game")
40+
elif user_choice == 1:
41+
if cpu_choice == 0:
42+
print("You lost the Game")
43+
if cpu_choice == 2:
44+
print("You win the Game")
45+
win += 1
46+
elif user_choice == 2:
47+
if cpu_choice == 0:
48+
print("You win the Game")
49+
win += 1
50+
if cpu_choice == 1:
51+
print("You lost the Game")
52+
count += 1
53+
54+
print("********Reaults********")
55+
print("Your Total Win : ", str(win))
56+
print("Computer Total Win : ", str(10-win-draw))
57+
print("Total No. of Draws : ", str(draw))
58+
59+
60+
61+
except Exception as e:
62+
print("Something went wrong")
63+
64+
65+
if __name__ == "__main__":
66+
random_choice_gen()

0 commit comments

Comments
 (0)