How about this one for recursion and control flow:

>>> def hcd(m,n):
...     r = m % n
...     if( r > 0 ):
...             hcd(n, r)
...     else:
...             print "hcd = %d" % (n,)
...
>>> hcd(119, 544)
hcd = 17
>>>

It calculates the highest common denominator for m and n. Plus it's E1
in TAoCP by Knuth.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to