from random import randint print ('---------------------------------------------' + '\n' + ' GUESS THE NUMBER APP' + '\n' + '---------------------------------------------' + '\n') number = randint(1, 100) while True: guess = input('Guess a number between 0 and 100 ("quit" to stop): ') if not guess.isdigit(): print("That's not a good guess! Please type a number.") elif int(guess) < number: print('Sorry but {} is LOWER than the number'.format(guess)) elif int(guess) > number: print('Sorry but {} is HIGHER than the number'.format(guess)) elif int(guess) == number: print("YES! You've got it. The number was {}.".format(number)) play_again = input('Would you like to play again? Yes or No?: ') if play_again.lower() == 'yes': number = randint(1, 100) elif play_again.lower() == 'no': print('Well, hope you had fun! Thanks for playing. ^_^') break elif guess.lower() == 'quit': print('Well, hope you had fun! Thanks for playing. ^_^') break