I'm trying to make a small program in Python that generates a random number (from the throw of a die) and asks the user to guess what the number is, and if the user guesses wrong, then depending on whether the guess is higher than the actual number or not the program is supposed to re-prompt them for another guess.
The problem that I'm having with the code is that the output is always "That's a little high. Try again!", even if I input all the possible values.
Can someone please help me figure out which portion of the code is generating the error?
import random
dice = random.randint(1,6)
answer = raw_input ("What do you think is the number?")
while (answer != dice):
if answer > dice:
print ("That's a little high. Try again!\n")
else:
print ("That's a little low. Try again!\n")
answer = raw_input ("What do you think is the number?")
print ("That's correct! Good job. \n")
Thank you!