import random

def start_game():
  min_num = 0
  max_num = 100


  secret_num = random.randint(min_num, max_num)

  max_attempts = 15 #هنا عدد التخمينات المتاحة

  # عدد المحاولات
  current_attempts = 0

  print(f"Welcome to the guess the numbers game. I'm thinking of a number between {min_num} and {max_num}. You have {max_attempts} attempts to guess it.")

  while True:
    current_attempts += 1

    guess = int(input(f"Guess the number{current_attempts}: "))

    if guess == secret_num:
      print(f"Congrats! You guessed the password after {current_attempts} attempts.")
      break
    
    elif guess < secret_num:
      print("Your guess is too low. Try again.")
    else:
      print("Your guess is too high. Try again.")

    if current_attempts == max_attempts:
      print(f"You've run out of attempts. The secret number was {secret_num}.")
      break

  choice = input("Want to play again? (yes/no): ")

  if choice.lower() == "yes":
    start_game()
  else:
    print("thanks for playing. See you soon.")

start_game()