Snake Water and Gun Game

 


print("Welcome to Snake Water Gun Game")

print("Enter your choice")

print("s=Snake")

print("w=Water")

print("g=Gun")


def converttxt2num():

  player1 = (input("Enter your choice player1: "))

  if player1 == 's':  return 1

  elif player1 == 'w': return 2

  elif player1 == 'g': return 3

  else:

    print("Invalid choice")

    return None


player1 = converttxt2num()


if player1==1:

  print("You chose Snake")

elif player1==2:

  print("You chose Water")

elif player1==3:

  print("You chose Gun")

else:

  print("Invalid choice")


def converttxt2num2():

  player2 = (input("Enter your choice player2: "))

  if player2 == 's':  return 1

  elif player2 == 'w': return 2

  elif player2 == 'g': return 3

  else:

    print("Invalid choice")

    return None


player2 = converttxt2num2()


if player2==1:

  print("You chose Snake")

elif player2==2:

  print("You chose Water")

elif player2==3:

  print("You chose Gun")

else:

  print("Invalid choice")


if (player1==1 and player2==1) or (player1 == 2 and player2== 2) or (player1 == 3 and player2== 3) :

  print("It's a draw")


elif(player1==1 and player2==2) or (player1==2 and player2==3) or (player1==3 and player2==1):

  print("Player1 wins")


elif(player1==1 and player2==3) or (player1==2 and player2==1) or (player1==3 and player2==2):

  print("Player2 wins")

else:

  print('game over')

Comments

Popular posts from this blog

Secret Code Language

Library Management System