forked from thejaswi13/Hacktoberfest-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
50 lines (42 loc) · 1.16 KB
/
main.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
import random
# Snake Water Gun or Rock Paper Scissors
def game_Win(comp, you):
# If two values are equal, declare a tie!
if comp == you:
return None
# Check for all possibilities when computer chose s
elif comp == 's':
if you=='w':
return False
elif you=='g':
return True
# Check for all possibilities when computer chose w
elif comp == 'w':
if you=='g':
return False
elif you=='s':
return True
# Check for all possibilities when computer chose g
elif comp == 'g':
if you=='s':
return False
elif you=='w':
return True
print("Comp Turn: Snake(s) Water(w) or Gun(g)?")
randNo = random.randint(1, 3)
if randNo == 1:
comp = 's'
elif randNo == 2:
comp = 'w'
elif randNo == 3:
comp = 'g'
you = input("Your Turn: Snake(s) Water(w) or Gun(g)?")
a = game_Win(comp, you)
print(f"Computer chose {comp}")
print(f"You chose {you}")
if a == None:
print("The game is a tie!")
elif a:
print("You Win The game!")
else:
print("You Lose The game !")