I'm trying to make a 'guess the number between 1-10' game but the while loops seems to keep running. I want to program to let the user guess a number then display if its too high or low etc then start again automatically (loop) to allow the user to pick again. This code makes it run forever though. Can you guys help me?
import randomdef numberGuess():printNow("I'm thinking of a number between 1 and 10")guess = 0 # give guess a starting valuerandNum = random.randrange(1,11) # this line generates a random numberguess = int(input("Try to guess the number:")) # ask user for a numberprint randNum while guess != randNum:if (guess == randNum): print "You got it!"if (guess > randNum):print "Wrong! You guessed too high"if (guess < randNum):print "Wrong! You guessed too low"