- 3
Why this code doesn't work perfectly plz help
import random def game(comp,u): if comp=="snake": if u=="water": return False else: return True elif comp=="gun": if u=="snake": return True else: return False elif comp=="water": if u=="gun": return False else: return True elif comp==u: return None print() com=(" choose gun, water, or snake") randomno=random.randint(1,3) #print(randomno) if randomno==1: computer="gun" elif randomno==2: computer="water" elif randomno==3: computer="snake" you=str(input("choose any one gun, water, or snake -->")) a=game(computer,you) print(f"computer choose --> {computer}") print(f"you choose --> {you}") if a==None: print("game tie") elif a==True: print("you won") elif a==False: print("you lose")
4 Answers
0
Could i please know where the problem is exactly. Is it an error, or is it not doing what you want?
0
There is no error but i didn't get desire output
0
Could i please know what the aim is?
0
Did you ever played snake, water and gun game Or stone, paper, scissors game