import random

def play_game():
    n = random.randint(1, 100)
    print("I'm thinking of a number between 1 and 100 ")
    print("you have 5 attempts to guess the number!")

    attempts = 5
    while attempts > 0:
        guess = int(input("Guess a number: "))
        attempts -= 1

        if guess < n:
            print("Too low")
        elif guess > n:
            print("Too high!")
        else:
            print("You guessed it right!")
            break
    else:
        print("You run out of attempts")
        print(f"The number is {n}")

while True:
    play_game()
    user_input = input("Do you want to play the game again? (yes/no) ")
    if user_input.lower() == "yes":
        print("Great! Let's play again.")
    elif user_input.lower() == "no":
        print("Okay, see you next time!")
        break
    else:
        print("Sorry, I didn't understand that. Please answer yes or no.")