首先,我只想说我最近开始编程,所以我不是很好。这是我的问题:
x = int(input("Write a number between 1-100: "))
while x > 100:
x = int(input("The number must be less than 101: "))
while x < 1:
x = int(input("The number must be higher than 0: "))
else:
print ("The number is:",x)
有一种方法可以通过这样做来欺骗代码:
Write a number between 1-100: 101
The number must be less than 101: 0
The number must be higher than 0: 101
The number is: 101
我基本上不希望用户能够写出高于 100 或低于 1 的数字。
我很抱歉解释不好,但我尽了最大努力,而且,我最近又开始编程了。