-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmain.py
More file actions
42 lines (30 loc) · 822 Bytes
/
main.py
File metadata and controls
42 lines (30 loc) · 822 Bytes
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
import random
'''
1 for snake
-1 for water
0 for gun
'''
computer = random.choice([-1, 0, 1])
youstr = input("Enter your choice: ")
youDict = {"s": 1, "w": -1, "g":0}
reverseDict = {1:"Snake", -1:"Water", 0:"Gun"}
you = youDict[youstr]
# By now we have 2 numbers (variables), you and computer
print(f"You chose {reverseDict[you]}\nComputer chose {reverseDict[computer]}")
if(computer == you):
print("Its a draw")
else:
if(computer ==-1 and you == 1):
print("You win!")
elif(computer ==-1 and you == 0):
print("You Lose!")
elif(computer ==1 and you == -1):
print("You Lose!")
elif(computer ==-1 and you == 0):
print("You win!")
elif(computer ==0 and you == -1):
print("You win!")
elif(computer ==0 and you == 1):
print("You Lose!")
else:
print("Something went wrong!")