diff --git a/gcd.py b/gcd.py index 5880a5b..da49444 100644 --- a/gcd.py +++ b/gcd.py @@ -1,13 +1,17 @@ # Wrong gcd find 5 mistakes def gcd(a, b): - assert a <= 0 and b >= 0 + assert a >= 0 and b >= 0 while a and b: if a > b: - a = a / b + a = a % b else: - b = b / a - return min(a, b) + b = b % a + return a + b + +print(gcd(10, 0)) +print(gcd(123, 3)) +print(gcd(1000000, 64)) # Examples