📜  5.3.7 更高 更低 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:04.044000             🧑  作者: Mango

代码示例1
magic_number = 3

# Your code here...
while True:
    user_guess = int(input("Please guess a number between 1 and 100: "))
    if user_guess == magic_number:
        print ("Correct!")
        break
    elif user_guess < magic_number:
        print ("Too low, try again.")
    else:
        print ("Too high, try again.")