#从简明Python搬来 number = 23 # 将23赋值给number的变量 running = True # 在while语句运行前,将running变量设置为ture while running: # 先检查变量running是否为ture,然后再运行相应的块 guess = int(input(‘Enter an integer : ‘)) if guess == number: print(‘Congratulations, you guessed it.‘) # 这将导致 while 循环中止 running = False elif guess < number: print(‘No, it is a little higher than that.‘) else: print(‘No, it is a little lower than that.‘) else: print(‘The while loop is over.‘) # 在这里你可以做你想做的任何事 print(‘Done‘)