a = raw_input ("enter a number")
i = 0
numbers = []
while i < a:
print "At the top i is %d" % i
numbers.append(i)
i = i + 1
print "Numbers now:", numbers
print "At the bottom i is %d" % i
print "The numbers: "
for num in numbers:
print num
Run Code Online (Sandbox Code Playgroud)
所以我正在关注lpthw并且只是搞乱了代码,为什么当我使用raw_input并输入一个像6这样的数字时这个循环会变成无限循环?不应该i = i + 1在那里阻止这种情况发生吗?