Skip to content

Commit 56a97a9

Browse files
Update gcd_iterative.py
Fix: replace single letter parameters with descriptive names
1 parent cfe0d16 commit 56a97a9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

maths/gcd_iterative.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def gcd_iterative(a: int, b: int) -> int:
1+
def gcd_iterative(first_number: int, second_number: int) -> int:
22
"""
33
Compute the greatest common divisor (GCD) of two numbers iteratively.
44
@@ -8,6 +8,6 @@ def gcd_iterative(a: int, b: int) -> int:
88
>>> gcd_iterative(7, 5)
99
1
1010
"""
11-
while b != 0:
12-
a, b = b, a % b
13-
return a
11+
while second_number != 0:
12+
first_number, second_number = second_number, first_number % second_number
13+
return first_number

0 commit comments

Comments
 (0)