guess the user input number using python

technical talkiess
0

 n =18

attempt = 0
print("You have only 9 attempt remain")
while(1):
    if(attempt < 9):
        print("Please Enter the number")
        user_input = int(input())
        if(user_input > n):
            print("Number is greater")
            attempt = attempt + 1
            print("Number of attempt is left ")
            print(9-attempt)
            continue
        elif(user_input < n):
            print("Number is lesser")
            attempt = attempt +1
            print("Number of attempt is left")
            print(9-attempt)
            continue
        elif(user_input == n):
            print("You Guess Right Number")
            attempt = attempt +1
            print("Attempt number when he guess12 " + str(attempt))
            break
    else:
        print("Game Is over ... beacuse you use the 9 attempt")
        break
Tags

Post a Comment

0Comments

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

Post a Comment (0)