PY
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
# gun game in python
'''
Snake vs. Water: Snake drinks the water hence wins.
Water vs. Gun: The gun will drown in water, hence a point for water
Gun vs. Snake: Gun will kill the snake and win.
In situations where both players choose the same object, the result will be a draw.
'''
# input s for snake
# input w for water
# input g for gun
import random
def gamewin(comp,you):
if comp == you:
return None
if comp == 's':
if you == 'g':
return True
elif you == 'w':
return False
if comp == 'w':
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run