我正在编写一个程序,在用户决定每行数字的地方显示数字,但数字必须在10到30之间,尽管出于任何原因,即使条件为true,while语句也不会执行。例如,如果我输入数字5;数字必须在10和30"之间;而是输出1到1000,每行5个数字。
以下是我的代码,如果您能提供任何帮助,将不胜感激
count = 0
X = int(input('please enter a number:'))
while X <=10 and X >=30:
print('Number must be between 10 and 30')
else:
for number in range (1, 1000, 1):
print(number,' ', end = '')
count = count + 1
if count == X:
print()
count = 0
请使用"OR";逻辑运算符,因为需要为<10或数字>30个条件。
而X<10或X>30:打印("数字必须在10到30之间"(