-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (27 loc) · 804 Bytes
/
main.py
File metadata and controls
36 lines (27 loc) · 804 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
import random
'''
1 for snake
-1 for water
0 for gun
'''
computer = random.choice([1,-1,0])
your_str = input("Enter your choice: ")
your_dict = {"snake": 1, "water":-1, "gun":0}
reverse_dict = {1:"Snake" , -1:"Water", 0:"Gun"}
you=your_dict[your_str]
print(f"You choose {reverse_dict[you]} \nComputer choose {reverse_dict[computer]}")
if you == computer:
print("It's a draw")
else:
if you == 1 and computer == -1:
print("You Won")
elif you == 1 and computer == 0:
print("Computer Won")
elif you == -1 and computer == 1:
print("Computer Won")
elif you == -1 and computer == 0:
print("You Won")
elif you == 0 and computer == -1:
print("Computer Won")
elif you == 0 and computer == 1:
print("You Won")