January 25, 2021

Snake Water Gun game using python

 



import random


def game(computer , your ):

if computer==your:

return None

elif computer=="s":

if your == "w":

return False

elif your=="g":

return True

elif computer =="w":

if your=="g":

return False

elif your== "s":

return True

elif computer == "g":

if your=="w":

return True 

elif your== "s":

return False

print ("\t\tSNAKE WATER GUN GAME \n")

print("computer turn ....... \nsnake(s) water (w) or gun (g)\n\t\nprocessing.......\n")

rando=random.randint(1,3)

if rando==1:

computer="s"

elif rando==2:

computer="w"

elif rando==3:

computer="g"


your = input ("your turn ::\n snake (s) water (w) or gun (g)  :  ")

a=game(computer,your)


print (f"\ncomputer choose {computer}")


if a== None :

print ('game is tie')

elif a:

print ('you win !!!')

else:

print("you lose !!!")


No comments:

Post a Comment

find the cube of the range given digits. || codeAj

Find the cube of the range given Digits. Source Code r= int ( input ( "enter the range of digit : " )) def number_conter (n): ...