# This works!
import random
from random import randint
n = ['no', 'n', 'No', 'N', 'NO']
y = ['yes', 'y', 'Yes', 'Y', 'YES']
x = random.randint(1,100)
print("Guess a number between 1 and 100.")
active = True
while active:
guess = int(input(""))
if guess == x:
print("Congratulations! Would you like to play again?")
play_again = input("")
if play_again in n:
print("Thanks for playing!")
active = False
elif play_again in y:
print("Guess a number between 1 and 100.")
elif guess < 1 or guess > 100:
print("You have to choose a number between 1 and 100.")
print("Please guess again.")
elif guess < x:
print("Please choose a higher number.")
elif guess > x:
print("Please choose a smaller number.")