'''gcd iterative and recursive variations'''
# Here is an iterative solution
def gcd(a,b):
"""Returns the gcd of its inputs times the sign of b if b is nonzero,
and times the sign of a if b is 0.
"""
while b != 0:
a,b = b, a % b
return a
# Here is a recursive solution
def gcdr(a,b):
"""Returns the gcd of its inputs times the sign of b if b is nonzero,
and times the sign of a if b is 0.
"""
if b == 0:
return a
else:
return gcdr(b, a % b)