snake or user game in python

technical talkiess
0

 import random

items = ['snake','water','gun'];


user_point = 0;

computer_point = 0;

i=0;

computer_choice = random.choice(items);

while(i<11):

    print("Please enter your choice");

    user_input = input();

    if(user_input == computer_point):

        continue;

    elif(user_input == 'snake' and computer_choice == 'water'):

        user_point +=1;

    elif(user_input == 'water' and computer_choice == 'gun' ):

        user_point+=1;

    elif(user_input == 'gun' and computer_choice == 'water' ):

        user_point+=1;

    elif(user_input == 'snake' and computer_choice == 'gun'):

        computer_point+=1;

    elif(user_input == 'water' and computer_choice == 'snake'):

        computer_point+=1;

    elif(user_input == 'gun' and computer_choice == 'water'):

        computer_point+=1;

    i +=1;

    

if(computer_point > user_point):

    print("User is won the match")

else:

    print("computer is won the match")

        

    

Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)