Aug-09-2020, 06:50 PM
from random import randrange def toohigh(): # displays too high sequence count += 1 return('Too high! Try again. ') guess = input('Guess my number between 1 and 1000. ') play() def toolow(): # displays too low sequence count += 1 return('Too low! Try again. ') guess = input('Guess my number between 1 and 1000. ') play() def correct(): # displays correct sequence count += 1 return('Congrats! That was the correct number!') if count <= 10: return('It took you ', str(count), 'guesses.' 'You either know the secret or got lucky.') if count > 10: return('It took you ', str(count), 'guesses.' 'I think you can do better than that.') playagain() def playagain(): playagain = input('Would you like to play again? y/n ') if playagain == 'y': play() count = 0 if playagain == 'n': return('Bye!') count = 0 else: return('Please answer y or n') playagain() def play(): # plays game count = 0 x = randrange(1000) guess = int(input('Guess my number between 1 and 1000. ')) while guess != x: if int(guess) > x: toohigh() if guess < x: toolow() if guess == x: correct() play()# I am 100% a noob, thank you for helping.