-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (29 loc) · 811 Bytes
/
main.py
File metadata and controls
34 lines (29 loc) · 811 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
import random
'''
-1 for Water
0 for Snake
1 for Gun
'''
computer = random.choice([-1, 0, 1])
youstr = input("Enter your choice: ")
youdict = {"S":0, "W":-1, "G":1}
reversedict = {1: "Gun", 0: "Snake", -1: "Water"}
you = youdict[youstr]
print(f"You chose: {reversedict[you]}\nComputer chose: {reversedict[computer]}")
if(computer == you):
print("Its 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 Lose!")
elif(computer == 0 and you == 1):
print("You Win!")
else:
print("Something went wrong!")