-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathSNAKE WATER GUN.PY
61 lines (50 loc) · 1.84 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
import random
def winner (computer,you):
# check is game is a tie
if you == computer:
print(f"YOU CHOONSE {you}" )
print(f"COMPUTER CHOOSE {computer}")
print(f"GAME IS A TIE ")
# compare values of you and computer
if you == 'snake 🐍' and computer == 'water 💦' :
print(f"YOU CHOONSE {you}")
print(f"COMPUTER CHOOSE {computer}")
print(f"YOU WIN ")
elif you == 'snake 🐍' and computer == 'gun 🔫' :
print(f"YOU CHOONSE {you}")
print(f"COMPUTER CHOOSE {computer}")
print(f"YOU LOOSE ")
elif you == 'water 💦' and computer == 'snake 🐍' :
print(f"YOU CHOONSE {you} ")
print(f"COMPUTER CHOOSE {computer}")
print(f"YOU LOOSE ")
elif you == 'water 💦' and computer == 'gun 🔫' :
print(f"YOU CHOONSE {you}")
print(f"COMPUTER CHOOSE {computer}")
print(f"YOU LOOSE ")
elif you == 'gun 🔫' and computer == 'water 💦' :
print(f"YOU CHOONSE {you}")
print(f"COMPUTER CHOOSE {computer}")
print(f"YOU LOOSE ")
elif you == 'gun 🔫' and computer == 'snake 🐍' :
print(f"YOU CHOONSE {you} ")
print(f"COMPUTER CHOOSE {computer}")
print(f"YOU WIN ")
# assigning random values to computer from range 1 to 3
computer=random.randint(1,3)
if computer == 1:
computer= 'snake 🐍'
if computer == 2:
computer= 'water 💦'
if computer == 3:
computer= 'gun 🔫'
you=(input("snake(s) 🐍 water(w) 💦 or gun(g) 🔫 ? : " ))
if you == 's':
you='snake 🐍'
elif you == 'w':
you='water 💦'
elif you == 'g':
you='gun 🔫'
else:
print("INVALID CHOICE")
winner(computer,you) # calling winner function