如何在以下 Jython 程序中包含一个 while 循环以保持用户猜测,直到他们得到正确答案?
import random
def numberGuess():
printNow("I'm thinking of a number between 1 and 10")
guess = 0
randNum = random.randrange(1,11)
guess = int(input("Try to guess the number: "))
if guess > 10:
print("Wrong! You guessed too high")
elif guess < 1:
print("Wrong! You guessed too low")
else :
print(" you got it")