<pre>import random repeat = 'y' i=1 while repeat.lower() == 'y': n = int(input("Enter value of n(1 - 100) ")) n2 =int(input("Enter value of n2(1 - 100) ")) a= random.randrange(n, n2) guess = int(input("Guess the hidden number")) while guess !=a: print('entry number:',i) if guess<a: print("you need to guess higher. Try again") guess = int(input("Guess the hidden number")) if guess>a: print("you need to guess lower. Try again") guess = int(input("Guess the hidden number")) if guess == a: print('it took you:',i,'tries to guess the hidden number') print('Congratulations, the hidden number is',a) repeat = input("\nDo you want to try again Y/N? \n>>> ") while repeat.lower() == 'n': print('thank you') break
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)