Good point. I suppose I'd only ever seen it implemented with the if
test, but you're right, the plain while loop should work fine. Silly
me.

def gcd(a,b):
     while b != 0:
           a, b = b, a%b
    return a

Even nicer.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to