From 326a9190766270742e6f7e01d482eaa59700c5eb Mon Sep 17 00:00:00 2001 From: Olga Tregub Date: Sun, 7 Oct 2018 01:29:46 +0300 Subject: [PATCH] All bugs fixed --- gcd.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcd.py b/gcd.py index 5880a5b..4d05b8d 100644 --- a/gcd.py +++ b/gcd.py @@ -1,13 +1,13 @@ -# Wrong gcd find 5 mistakes +# Wrong gcd find 4 mistakes #5 def gcd(a, b): - assert a <= 0 and b >= 0 + assert a >= 0 and b >= 0 #1 while a and b: if a > b: - a = a / b + a = a % b #2 else: - b = b / a - return min(a, b) + b = b % a #3 + return max(a, b) #4 # Examples