Skip to content

Commit 8a50961

Browse files
Merge pull request seeditsolution#229 from fahad-25082001/patch-1
Snake water gun game
2 parents 6e92421 + bd503c6 commit 8a50961

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

Snake water gun game

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SNAKE WATER GUN GAME
2+
3+
import random
4+
lst=['s','w','g']
5+
chance=10
6+
no_of_chance=0
7+
human_points =0
8+
computer_points=0
9+
print("\t \t \t \t SNAKE, WATER , GUN GAME \t \t \t \t")
10+
print("s for sanke ")
11+
print("w for water")
12+
print("g for gun")
13+
while no_of_chance<chance:
14+
inner = input('Snake,Water,Gun:')
15+
outer = random.choice(lst)
16+
17+
if inner == outer:
18+
print("Tie both of them will get 0 points")
19+
20+
elif inner=="s" and outer=="g":
21+
computer_points=computer_points+1
22+
print(f"your guess {inner} and computer guess {outer}")
23+
print("computers wins 1 point")
24+
print(f"computer_points is {computer_points} and your point is {human_points}\n")
25+
26+
elif inner == "s" and outer == "w":
27+
human_points = human_points + 1
28+
print(f"your guess {inner} and computer guess {outer}")
29+
print("human wins 1 point")
30+
print(f"computer_points is {computer_points} and your point is {human_points}\n")
31+
32+
# if user enter g
33+
34+
elif inner == "g" and outer == "s":
35+
computer_points = computer_points + 1
36+
print(f"your guess {inner} and computer guess {outer}")
37+
print("computers wins 1 point")
38+
print(f"computer_points is {computer_points} and your point is {human_points}\n")
39+
40+
elif inner == "g" and outer == "w":
41+
human_points = human_points + 1
42+
print(f"your guess {inner} and computer guess {outer}")
43+
print("human win 1 point")
44+
print(f"computer_points is {computer_points} and your point is {human_points}\n")
45+
46+
# if user enter a w
47+
48+
elif inner == "w" and outer == "s":
49+
computer_points = computer_points + 1
50+
print(f"your guess {inner} and computer guess {outer}")
51+
print("computers wins 1 point")
52+
print(f"computer_points is {computer_points} and your point is {human_points}\n")
53+
54+
55+
elif inner == "w" and outer == "g":
56+
human_points = human_points + 1
57+
print(f"your guess {inner} and computer guess {outer}")
58+
print("human wins 1 point")
59+
print(f"computer_points is {computer_points} and your point is {human_points}\n")
60+
61+
else:
62+
print("you hane given a wrong input \n")
63+
64+
no_of_chance=no_of_chance+1
65+
print(f"{chance - no_of_chance} is left out of {chance} \n")
66+
67+
print("GAME OVER")
68+
69+
if computer_points==human_points:
70+
print("matched tied")
71+
elif computer_points>human_points:
72+
print("computer wins and human loose")
73+
else:
74+
print(" human wins and computer loose")
75+
76+
print(f"human point is {human_points}and computer point is {computer_points}")

0 commit comments

Comments
 (0)