import random

def play_again():
    
    play =input("Do You Want Play Again? (yes/no): ").lower()
    return play == "yes"

while True:

    number = random.randint(1,100)
    guess = 0
    attempts = 0
    max_attepts = 10

    while guess != number and attempts < max_attepts:

        remaining_attempts = max_attepts - attempts
        print(f"You've {remaining_attempts} attempts left.")

        guess =int(input("Guess Number: "))
        attempts += 1

        if guess < number:
            print("Guess Higher!")

        elif guess > number:
            print("Guess Lower!")

        else:
            print(f"{guess} is Correct Guess!")
            print(f"You took {attempts} attempts to guess the number")
            break

    if attempts == max_attepts:
        print("You've used all your attempts, The correct number was:",number)

    if not play_again():
        print('Thanks for Playing')
        break