-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathSnakeWaterGunGame
71 lines (50 loc) · 1.48 KB
/
SnakeWaterGunGame
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
# Snake Water Gun Game Devlopement
import random
NoOfRound = 10
user = 0
comp = 0
while NoOfRound > 0:
print("---------------------------------")
print("Choices:\nS-Snake\nW-Water\nG-Gun")
c = input("Enter Your Choice:-")
choice = c.capitalize()
if choice in ('S', 'W', 'G'):
n = random.randint(1, 3)
if (choice == 'S' and n == 1) or (choice == 'W' and n == 2) or (choice == 'G' and n == 3):
print("Draw")
elif choice == "S":
if n == 2:
print("Congratulations. You Won!")
user += 1
else:
print("Better Luck Next Time!")
comp += 1
elif choice == "W":
if n == 3:
print("Congratulations. You Won!")
user += 1
else:
print("Better Luck Next Time!")
comp += 1
else:
if n == 1:
print("Congratulations. You Won!")
user += 1
else:
print("Better Luck Next Time!")
comp += 1
else:
print("Invalid Choice")
continue
NoOfRound -= 1
print("---------------------------------")
if user == comp:
print("Draw!")
elif user > comp:
print("Hurray. You won!")
else:
print("You Lost!")
print("---------------------------------")
print("Scoreboard")
print("Your Score:-", user, "\nComputer's Score:-", comp )
print("---------------------------------")