-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnake water gun.py
64 lines (64 loc) · 2.33 KB
/
snake water gun.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
63
64
import random
choices = ["snake","water","gun"]
computerWin = 0
playerWin = 0
drawRound = 0
turn = 1
i = 10
while i>0:
computerChoice = random.choice(choices)
userChoice = input(f"round number {turn}\nenter your choice\ns for snake, w for water, g for gun: ")
if userChoice.lower() == "s":
if computerChoice == "snake":
print(f"computer choice is {computerChoice} \n ROUND DRAW\n")
turn = turn+1
i = i-1
drawRound = drawRound+1
elif computerChoice == "water":
print(f"computer choice is {computerChoice}\nYOU WON THIS ROUND\n")
turn = turn+1
i=i-1
playerWin = playerWin+1
else:
print(f"computer choice is {computerChoice}\nYOU LOSS THIS ROUND\n")
turn = turn+1
i=i-1
computerWin = computerWin+1
elif userChoice.lower() == "w":
if computerChoice == "water":
print(f"computer choice is {computerChoice} \n ROUND DRAW\n")
turn = turn+1
i = i-1
drawRound = drawRound+1
elif computerChoice == "gun":
print(f"computer choice is {computerChoice}\nYOU WON THIS ROUND\n")
turn = turn+1
i=i-1
playerWin = playerWin+1
else:
print(f"computer choice is {computerChoice}\nYOU LOSS THIS ROUND\n")
turn = turn+1
i=i-1
computerWin = computerWin+1
elif userChoice.lower() == "g":
if computerChoice == "gun":
print(f"computer choice is {computerChoice} \n ROUND DRAW\n")
turn = turn+1
i = i-1
drawRound = drawRound+1
elif computerChoice == "snake":
print(f"computer choice is {computerChoice}\nYOU WON THIS ROUND\n")
turn = turn+1
i=i-1
playerWin = playerWin +1
else:
print(f"computer choice is {computerChoice}\nYOU LOSS THIS ROUND\n")
turn = turn+1
i=i-1
computerWin = computerWin+1
else:
print(f"computer choice is {computerChoice}\nYOU LOSS THIS ROUND as you enter a wrong input\n")
turn = turn+1
i=i-1
computerWin = computerWin+1
print(f"Game Over\ncomputer win = {computerWin}\nplayer win = {playerWin}\ndraw round(s) = {drawRound}")