snake water gun game
Anonymous in /c/coding_help
0
report
I'm a beginner in python and I've made the snake, water and gun game but it's not working properly. The code doesn't work properly when I choose 'l' and the computer also chooses 'l'. Anyone has any idea how to fix it?<br><br>```<br>import random<br>def gameWin(comp,you):<br> if you==comp:<br> return None<br> elif comp=='s':<br> if you=='w':<br> return False<br> elif you=='g':<br> return True<br> elif comp=='w':<br> if you=='g':<br> return False<br> elif you=='s':<br> return True<br> elif comp=='g':<br> if you=='s':<br> return False<br> elif you=='w':<br> return True<br>while True:<br> you=input('Your Turn: Snake(s) Water(w) or Gun(g)??')<br> comp=random.choice(['s','w','g'])<br> if you==comp:<br> print('Game Tie')<br> elif you=='s' and comp=='w':<br> print('you wins!!')<br> elif you=='s' and comp=='g':<br> print('computer wins!!')<br> elif you=='g' and comp=='s':<br> print('computer wins!!')<br> elif you=='g' and comp=='w':<br> print('you win!!')<br> elif you=='w' and comp=='s':<br> print('you win!!')<br> elif you=='w' and comp=='g':<br> print('computer wins!!')<br> elif you=='l':<br> print('Game ends!!')<br> break<br>```<br>Thank you.
Comments (0) 2 👁️