-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStone_paper_scissor.py
27 lines (27 loc) · 993 Bytes
/
Stone_paper_scissor.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
import random
def game():
computer=random.choice([-1,0,1])
user=input("Your turn : ")
dic={-1:"stone",0:"paper",1:"scissor"}
reverse_dic={"stone":-1,"paper":0,"scissor":1}
you=reverse_dic[user]
print(f"\nYour choice is {user}")
print(f"Computer choice is {dic[computer]}")
if(computer == you):
print("The game is draw.. !")
else:
if(computer==-1 and you==0):
print("You won.. !")
elif(computer==0 and you==-1):
print("You lose.. !")
elif(computer==0 and you==1):
print("You won.. !")
elif(computer==1 and you==0):
print("You lose.. !")
elif(computer==1 and you==-1):
print("You won.. !")
elif(computer==-1 and you==1):
print("You lose.. !")
else:
print("Something went wrong... ! ")
game()