
import random
try :
 def num_guesing():
    age = int(input("enter your age :"))
    if age < 5 :
     print("sorry this game for more then +5 years")
    number = random.randint(1,100)
    attempts = 5
    print("welcome to the number guessing game ")
    print("you have  selected a number between 1 and 100. You have 5 attempts to guess it.'good luck'")
    
    while attempts > 0 :
        guess = int(input("Enter your guess (1-100):"))
        if guess < number:
            print("too low , try again")
        elif guess > number:
            print("too high , try again ")
        else:
            print("Congratulations! You guessed the number correctly:", number)
            return
        attempts-= 1
        print("attempts left:", attempts)
    print("Sorry, you've run out of attempts. The number was:", number)
    
    play_again = input("do you want play again (yes/no)?")
    if play_again == 'yes':
        num_guesing()
    else:
        print("Thank you for playing! ")
            
 num_guesing()
except:  
 print("error the use !!")