From e068b776e82c15599e2532e29a2767cc834fff22 Mon Sep 17 00:00:00 2001 From: dhruvakidadumbe Date: Wed, 7 Jan 2026 17:52:02 +0530 Subject: [PATCH 1/4] Improve docstring clarity for gcd function --- maths/gcd.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 maths/gcd.py diff --git a/maths/gcd.py b/maths/gcd.py new file mode 100644 index 000000000000..4a8fe384c7e2 --- /dev/null +++ b/maths/gcd.py @@ -0,0 +1,21 @@ +def gcd(a: int, b: int) -> int: + """ + Compute the Greatest Common Divisor (GCD) of two integers using + the Euclidean algorithm. + + The GCD is the largest positive integer that divides both numbers + without leaving a remainder. + + >>> gcd(48, 18) + 6 + >>> gcd(7, 5) + 1 + >>> gcd(0, 10) + 10 + >>> gcd(10, 0) + 10 + + :param a: first integer + :param b: second integer + :return: greatest common divisor of a and b + """ \ No newline at end of file From 59461c8ddbd5d9ea675ef84833a387af9bce607f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 12:34:18 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/gcd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maths/gcd.py b/maths/gcd.py index 4a8fe384c7e2..56fb45531f1c 100644 --- a/maths/gcd.py +++ b/maths/gcd.py @@ -18,4 +18,4 @@ def gcd(a: int, b: int) -> int: :param a: first integer :param b: second integer :return: greatest common divisor of a and b - """ \ No newline at end of file + """ From 83806230325a481ebfae15d342070bf1d433f899 Mon Sep 17 00:00:00 2001 From: dhruvakidadumbe Date: Wed, 7 Jan 2026 18:19:41 +0530 Subject: [PATCH 3/4] Fix doctest examples for gcd docstring --- maths/gcd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/maths/gcd.py b/maths/gcd.py index 56fb45531f1c..747612ab7d19 100644 --- a/maths/gcd.py +++ b/maths/gcd.py @@ -10,10 +10,10 @@ def gcd(a: int, b: int) -> int: 6 >>> gcd(7, 5) 1 - >>> gcd(0, 10) - 10 - >>> gcd(10, 0) - 10 + >>> gcd(48, 18) +6 +>>> gcd(7, 5) +1 :param a: first integer :param b: second integer From d9d93edfcddd74a7032ddee0c17794c90f05cd73 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 7 Jan 2026 12:56:08 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- maths/gcd.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/maths/gcd.py b/maths/gcd.py index 747612ab7d19..54b58684f475 100644 --- a/maths/gcd.py +++ b/maths/gcd.py @@ -1,21 +1,21 @@ def gcd(a: int, b: int) -> int: """ - Compute the Greatest Common Divisor (GCD) of two integers using - the Euclidean algorithm. + Compute the Greatest Common Divisor (GCD) of two integers using + the Euclidean algorithm. - The GCD is the largest positive integer that divides both numbers - without leaving a remainder. + The GCD is the largest positive integer that divides both numbers + without leaving a remainder. - >>> gcd(48, 18) + >>> gcd(48, 18) + 6 + >>> gcd(7, 5) + 1 + >>> gcd(48, 18) 6 >>> gcd(7, 5) 1 - >>> gcd(48, 18) -6 ->>> gcd(7, 5) -1 - :param a: first integer - :param b: second integer - :return: greatest common divisor of a and b + :param a: first integer + :param b: second integer + :return: greatest common divisor of a and b """