Skip to content

Commit 208fa54

Browse files
committed
Update logic gcd.py
1 parent 837c4e3 commit 208fa54

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

brain_games/games/gcd.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,11 @@ def get_nums_and_answer():
77
num_1 = get_random_num()
88
num_2 = get_random_num()
99
a, b = num_1, num_2
10-
gcd_value = ''
11-
12-
if b == 0 or a == b:
13-
gcd_value = a
14-
else:
15-
remainder = a % b
16-
while remainder != 0:
17-
remainder = a % b
18-
a = b
19-
b = remainder
20-
gcd_value = a
10+
11+
while b != 0:
12+
a = b
13+
b = a % b
14+
gcd_value = a
2115

2216
return f'{num_1} {num_2}', str(gcd_value)
2317

0 commit comments

Comments
 (0)