无论我尝试什么,我都会用这个函数得到一个无限循环:
# Excercise 33 - LPTHW
i = 0
numbers = []
#Ec 1
#numb = 6
#iplus = 10
def theloop(numb):
global i
#i = 0
#number = []
while i < numb:
print "At the top of 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
theloop(7)
当我运行脚本时,它会一直打印:
At the top of i is 0
At the top of i is 0
...
提前谢谢。
目前没有回答
相关问题 更多 >
编程相关推荐