我想在python列表中输入10到20之间的8个数字。但是“ i = i-1”操作不起作用,在for循环中,列表中的数据都无法获取。我正在使用python 2.7.1。
values = [None] * 8
for i in range(8):
x = int(input("Enter a number : "))
if x < 10 or x > 20:
i = i - 1
else:
values[i] = x
print values