import random
while True:
print("WELCOME TO NUMBER GUESSING GAME \n SHOWOFF YOUR GUESSING POWER HERE.")
secret = random.randint(1, 100)
t_attempts = 10
attempts = 10
while True:
try:
guess = int(input("Enter your guess: "))
if guess < 1 or guess > 100:
raise ValueError("Choose number between 1 to 100")
except ValueError as e:
print(e)
continue
if guess > secret:
print("The number you chose is higher than the number choosed by me(computer)")
elif guess < secret:
print("The number you chose is smaller than the number choosed by me(computer)")
else:
print("Correct")
print("Win \n Attempts used:", t_attempts - attempts)
break
attempts -= 1
print("Attempts left:", attempts)
if attempts == 0:
print("The number was:" , secret)
print("BETTER LUCK NEXT TIME, THE GAME IS OVER.")
again = input("Do you want to play again? (yes/no)")
if again != "yes":
break