import random
def gamewin(comp,you):
if comp==you:
return None
elif comp == 'r':
if you =='s':
return False
elif you == 'p':
return True
elif comp =='p':
if you == 'r':
return False
elif you == 's':
return True
elif comp == 's':
if you =='p':
return False
elif you == 'r' :
return True
print("comp's turn : rock(r) paper(p) or scissor(s) ??\n")
randNO = random.randint(1,3)
if randNO == 1 :
comp ='r'
elif randNO == 2 :
comp = 'p'
elif randNO == 3 :
comp = 's'
you = input("your's turn : rock(r) paper(p) or scissor(s) ??\n")
a = gamewin(comp,you)
print(f"computer chosse {comp}")
print(f"you chosse {you}")
if a == None:
print("the game is a tie")
elif a:
print("you win")
else :
print("you loose")
Comments
Post a Comment