-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path01_main.py
More file actions
35 lines (30 loc) · 870 Bytes
/
01_main.py
File metadata and controls
35 lines (30 loc) · 870 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
import random
'''
1 snake
-1 water
0 gun
'''
computer = random.choice([-1, 0, 1])
ME = input("Enter your choice : " )
youDict ={"s": 1, "w": -1, "g": 0}
reverseDict = {1: "Snake", -1: "Water", 0: "Gun"}
you= youDict[ME]
# By now we have 2 numbers (variables), you and computer
print(f"You chose {reverseDict[you]}\nComputer chose {reverseDict[computer]}")
if(computer == you):
print("It's a tie")
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("Invalid input")