代码将要求输入大于 100 的数字,如果小于 100,则将激活循环,​​否则将显示 "the number is > 100"

Code will ask to input a digit greater than 100 and if it will be smaller than 100 so a loop will be activated else it will show "the number is > 100"

请告诉我如何更正此代码

你好,我今年 12 岁,我在第 8 名 Class 我的老师给我这个任务来编写一个程序,要求输入一个大于 100 的数字,然后它会检查它是否是是否大于 100,如果不是,它将应用一个 for 循环,如果大于 100,它将显示“数字大于 100”

您的代码应如下所示:

a = int(input("Enter a value bigger than 100: "))

# loop ends if the number is bigger than 100 otherwise it will run forever
while a <= 100: 

    print("try again")
    # asks the use for input 
    a = int(input("Enter a value bigger than 100: "))

print("Congrats, you entered a value bigger than 100")