Say that the SECRET_NUMBER = 77. I want the function to keep prompting the user until the secret number is guessed. However, the 'your guess is too low' or 'your guess is to high' isn't working properly. If I enter guess_number(4), it says guess is too low, but if I next put in 100, it still says my guess is too low. What might be wrong with my function?
def guess_number(num):
'''(int) -> NoneType
Print out whether the secret number was guessed or a hint, if the
number was not guessed. Make this prompt the user for a number until the
secret number is guessed.
>>> guess_number(50)
Your guess was too low!
'''
while num != SECRET_NUMBER:
if num < SECRET_NUMBER:
print('Your guess was too low!')
input('Guess a number: ')
elif num > SECRET_NUMBER:
print('Your guess was too high!')
input('Guess a number: ')
else:
print('You guessed it!')