Exercise 33: While Loops

while用起来不如for安全。

i = 0
numbers = []
while i < 6:
  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

 

posted @ 2014-10-25 11:06  林中细雨  阅读(128)  评论(0编辑  收藏  举报