"""Examples of iteration using the while statement"""
def countdown(n) :
while n > 0 :
print n
n = n-1
print "Blastoff!"
def num_digits(n) :
"""counts the number of digits in a number"""
count = 0
while n > 0 :
count = count + 1
n = n // 10
return count
# what does this function do?
def mystery1(n) :
i = 1
s = 0
while (i < n) :
s += i # this is the same as s = s + i
i += + 1 # same as i = i + 1
return s
# now how about this one:
def mystery2() :
n = 1
while (n > 0) :
print n
n += 1 # same as n = n + 1
