How can I convert this while-loop into a function, so I can call it multiple times.
i = 0
numbers = []
while i < 6:
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
you can add, remove part of code you need. You can also return some value to use in main program.